5

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?

skaffman
  • 398,947
  • 96
  • 818
  • 769
Timwi
  • 65,159
  • 33
  • 165
  • 230

4 Answers4

2

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

Timwi
  • 65,159
  • 33
  • 165
  • 230
1

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?

JaredPar
  • 733,204
  • 149
  • 1,241
  • 1,454
  • 2
    Thanks. I searched Connect and it turns out the bug is known since VS 2005, and has not been fixed in 2008 because it is incorrectly classified as a feature request. If you are somehow connected with Microsoft, do you think you could effect the necessary change to turn it back into a bugreport? https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=91853 – Timwi Sep 14 '09 at 13:46
  • 6
    It's 2015 in a few days, and apparently, 10 years later, this is still a "feature" of visual studio, that it creates a completely unused, unnecessary, empty, directory tree in the middle of your source tree, even whe explicitly instructed not to. Sigh. Also, the link in the comment above is stale. Anybody have a live replacement? – David I. McIntosh Dec 29 '14 at 04:14
0

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>
someone
  • 122
  • 2
  • 9
0

Actually, also Microsoft suggests you to add command as a post-build action

rd "$(ProjectDir)obj" /s /q

see more at To set the intermediate output directory for a project (.NET projects)

Stipec
  • 1
  • 2