views:

626

answers:

2

I'm currently in the process of stripping down, refactoring and cleaning up a medium sized (15 ish projects) Visual Studio solution. The solution contains projects in both C++ and C#.

I'm keen to keep things as neat as possible in terms of output - seperating anything compiler created from source code, as it helps subversion (okay, I can tell it to ignore files, but I still feel it's messy) from freaking out.

The output I would like to achieve is as follows:

SolutionDir/
SolutionDir/src/project1/{ Code here }
SolutionDir/int/project1/configuration/{.obj files and other misc compiler junk here}
SolutionDir/bin/project1/configuration/{The fun stuff goes here}

This seems trivial with C++ projects as you can specify both the output and the intermediates directory. However with C#, at least through the Visual Studio 2008 User Interface it seems impossible to move the obj directory?

After doing some digging, I added

<IntermediateOutputPath>..\..\int\ProjectName\Debug\</IntermediateOutputPath>

to the C# .csproj

This appears to work, sort of. It's true the intermediates appear to end up there, but a directory 'obj' and under it a configuration directory (e.g. 'debug') and then a 'TempPE' directory are created in the old location - all of which are empty.

This isn't really a big deal, but it would be nice to know the cause of this behavior and if possible a way to fix it.

Thanks in advance!

+1  A: 

I'd recommend adding directories that you want to ignore to an SVN ignore property one-level-up. Also, when you do an initial commit and don't add bin and obje directories, SVN clients won't freak. On another note, consider placing generated files into GeneratedFiles subdirectory of your project, and not checking that directory into SVN.

GregC
All this is just workarounds, but you may find them helpful.
GregC
Thank you - helpful enough to +1, not enough to accept the answer, yet ;)
Ali Parr
A: 

I've been searching for a solution for this problem myself, and came up with something less intrusive.

Create a bat file named "CleanSrcDir.bat" somewhere (i placed mine in my project path) with the following contents:

rmdir /S /Q %1obj
SET %ERRORLEVEL%=0

After this, add something similar to the C# project's post-build events:

$(ProjectDir)CleanSrcDir.bat $(ProjectDir)

(This assumes you placed your bat file in the project directory, of course.) Then change the post-build settings to "Always", and you're done.

It's a little hackish, but sure makes the version control problem go away.

CreoValis