views:

344

answers:

3

In VS 2008, is there a way to set the intermediate directory (where the .obj files go, not the final targets) in a C# project?

A: 

I don't believe so. However, you can copy your executables, dlls, whatever, to another folder in a post-build event. (Build Events tab in Project Properties)

Jon Seigel
+3  A: 

You need to override BaseIntermediateOutputPath msbuild var, more about it here.

Shay Erlichmen
That does work for the most part but I was looking for a way to set it in each project so building from the IDE would not pollute the source folder. However, setting BaseIntermediateOutputPath in the project triggers a security warning. Alas, this does not seem possible. sigh...
Mike Ward
The security warning is there to notify you that something out of the ordinary has happen, you can mute the warning, and you won't see it again until you change the something else.
Shay Erlichmen
@Shay - there is nothing out of the ordinary about customizing intermediate output location. Visual Studio happily accepts C++ projects customizing intermediate files location (via IntDir property) without a security warning dialog, yet it does throw a tantrum when the same is done in C# project.
Milan Gardian
A: 

I have tried to move the "obj" files as well. Setting BaseIntermediateOutputPath in the .csproj works. Yes it warns about security, but I decided that I was a trusted source.

[[ BTW, there is another setting called IntermediateOutputPath that defaults to "$(BaseIntermediateOuputPath)\$(Configuration)". You can set this directly instead if you want. ]]

My issue is that there is still one file left behind in my "src" tree: [[ProjectSrcDir]]\obj\Debug\TempPE\Properties.Resources.Designer.cs.dll.

Any ideas on how to move this file into the IntermediateOutputPath folder?

pkg