The file 'file' could not be added to the project. <reason>

 

A file that has been read from the .vbproj or .csproj file cannot be added to the project. Reasons include:

  • Invalid file name.

  • File within a path. For example, if you have a project-relative path of File1\File2.txt, but there is also a folder with relative path File1\File2.txt.

  • Item already exists. This occurs when a file is listed twice in the project file.

  • Link already exists. The Visual Basic and Visual C# project system has a limitation in that there can only be one link with the same name per project. This means, for example, that you cannot have a link to file.vb in both folder A and folder B of the project.

This error is most likely caused by editing the project file by hand.

Any file for which this diagnostic is displayed will not be added to the project.

See Also

Project Files
NIB:Item Management in Projects