visual studio - The file could not be added to the project. This file is within the project directory tree error -


whenever try add file visual studio project, following warning:

the file [filename] not added project. file within project directory tree

how fix error?

go in windows file explorer , navigate .csproj file , open notepad (or advanced text editor notepad++)

you notice 2 lines have similar or duplicate compile include lines:

<compile include="..\projectdir\subdir\myclass.cs">   <link>"subdir\myclass.cs"</link> </compile> 

remove above line , keep line similar 1 below:

<compile include="subdir\myclass.cs" /> 

Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -