How do I prevent Visual Studio from creating obj folders in my source directory?

笑着哭i 提交于 2019-12-10 15:21:13

问题


I've set the OutputPath, IntermediateOutputPath, and BaseIntermediateOutputPath tags in all my csproj files. Despite that, Visual Studio creates extra "obj" folders in my source directories. As far as I can tell, it creates the directory obj\Debug\TempPE and then leaves it empty.

I don't mind Visual Studio creating all sorts of crap, but how do I tell it to create it only in places where I want it, not in the source directory?


回答1:


It is not possible to prevent Visual Studio 2008 from doing this.




回答2:


It's possible that you're running into a bug. If you see the obj folder being created but not containing any data and you see the expected files being created in the path you specified it may be an oversight.

If this is the case can you please file a bug on connect?

  • http://connect.microsoft.com



回答3:


Remove obj folder after build works for me.

There is two way to remove it.

  1. Add the following command in Project -> Property -> Build Event -> AfterBuild .

rmdir /s /q obj

Or

  1. Add the following section in .csproj
  <PropertyGroup>
    <PostBuildEvent>rmdir /s /q obj</PostBuildEvent>
  </PropertyGroup>


来源:https://stackoverflow.com/questions/1415443/how-do-i-prevent-visual-studio-from-creating-obj-folders-in-my-source-directory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!