An Archived Managed World

This blog has moved to http://www.managed-world.com/blog

  Home  |   Contact  |   Syndication    |   Login
  473 Posts | 0 Stories | 429 Comments | 1288 Trackbacks

News

Twitter












Tag Cloud


Archives

Post Categories

Blog Roll

[Crosspost from Managed World]

As I've mentioned in a previous article, I was annoyed with Visual Studio .NET 2002/2003 and the fact that you can't change the obj directory. I'm a stickler for keeping my src directory clean. My annoyance was due to the fact that you could _not_ change the directory the intermediate files for C# were saved to. Well, I'm pleased to announce that it appears it has now changed.

You can change the "BaseIntermediateOutputPath" value in your MSBuild file and that will change where the intermediate files are created. Thanks Microsoft :). I can now have the exact directory structure I want without it being dictated to me by Microsoft. It's about time :).

Thanks go to Day Dreamer who pointed this out to me as a comment to the earlier post linked to above.

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati
posted on Saturday, March 11, 2006 7:35 PM

Feedback

# re: Changing the obj directory in .NET 2.0 7/26/2006 4:30 PM Young Methusaleh
I find that if you override BaseIntermediateOutputPath in the proj files then rebuilds will fail when run inside the IDE if the default obj\debug folder does not exist. Of course the IDE does not write any file to the default obj folder, it just fails if they are not there. The really bad news is that the IDE will still create the obj folder when you reopen a project anyway...
If anyone knows how to make the IDE work properly then I would love to know about it..

# re: Changing the obj directory in .NET 2.0 10/31/2006 7:05 AM EricP
Methusaleh, I have the same problem than you, the obj folder is always recreated when I reopen the project. Could you solve this problem ?

Thanks,
Eric

# re: Changing the obj directory in .NET 2.0 8/29/2007 10:30 AM Pradeep Prabhakar
You can add a BaseIntermediateOutputPath tag under each of the target platform property groups. <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<BaseIntermediateOutputPath>myLibrary\obj\Debug</BaseIntermediateOutputPath>

Visual studio csproj files are msbuild files and should take most of the msbuild options

# re: Changing the obj directory in .NET 2.0 4/23/2009 11:42 PM Pradeep
The really bad news is that the IDE will still create the obj folder when you reopen a project anyway. If anyone knows how to make the IDE work properly then I would love to know about it.

# re: Changing the obj directory in .NET 2.0 9/10/2010 6:07 AM Antal Dominik
Put this to the post-build script, to remove the obj folder.

REM This removes the unused annoying obj folder after build.
rd "$(ProjectDir)obj" /S /Q

# re: Changing the obj directory in .NET 2.0 11/3/2010 2:31 AM Batesville Tool & Die
I also like to keep my directory clean! It really irks me when it becomes unorganized and sloppy. Thanks Antal Dominik for the post-build script!

# re: Changing the obj directory in .NET 2.0 11/18/2010 10:01 PM gusev
You are right, I have the same problem.

# re: Changing the obj directory in .NET 2.0 12/9/2010 10:33 AM game price comparison
pradeep, have you found fix for the problem yet? I would also like to know how to get rid of auto folder creation in IDE

# re: Changing the obj directory in .NET 2.0 12/29/2010 6:19 AM aspirateur autonome
Thank for this post, always fun to read you guys :D

Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification: