4

Is there a way to get a VS project to build the debug EXE to a directory other than bin/debug?

I found this: http://msdn.microsoft.com/en-us/library/ms165410%28v=vs.80%29.aspx

However, that is only for the RELEASE not for debug.

UPDATE:

I failed to mention this is for the Express version, not the full version.

For anyone else who wants to do the same, here is how:

  • Open your '.csproj' file.
  • Find an element 'PropertyGroup' which defines the debug building process.
  • Then, inside you will find another element called 'OutputPath'. Just change the value of its text to the directory you want your debug output to go to.
Alexei Levenkov
  • 98,904
  • 14
  • 127
  • 179
Lee Loftiss
  • 3,035
  • 7
  • 45
  • 73
  • What do you mean "not for debug"? – Alexei Levenkov Mar 22 '13 at 08:00
  • You can 'f5' which builds for debug, or you can ctrl+b which builds the release. When I hit 'f5', I would like the EXE to be compiled to a directory other than bin/debug. – Lee Loftiss Mar 22 '13 at 08:03
  • I changed it to say RELEASE so it is clearer. Thanks Alexei. – Lee Loftiss Mar 22 '13 at 08:04
  • Than change settings for DEBUG configuration... Also I'm not sure if Express editions have the choice of configuration if you use it... but even than you can simply edit .csproj file any way you like... – Alexei Levenkov Mar 22 '13 at 08:09
  • it is ok to post answer as answer and even accept it (also now you have properly written answer too to accept). On VS - it may be possible (again not have Express handy to check) to right click on project in "Solution Explorer" and chose "Unload project", than right click again and you'll see "Edit ProjectName.csproj" to do it directly in VS. Right click again and pick "Reload Project". – Alexei Levenkov Mar 22 '13 at 15:55
  • Well, you actually had the answer, so I'd rather give you credit for it if you want to post it. Thanks again for the help. – Lee Loftiss Mar 22 '13 at 23:09

2 Answers2

4

To change the build output directory:

On the Project menu, click Properties.
Click the Build tab.
Click the Browse button next to the Output path box and select a new build output directory.

MSDN :Change Build output directory

Change debug directory.

Sachin
  • 40,216
  • 7
  • 90
  • 102
  • Those are the same instructions at at the link I gave above. That is only for the build, not the debug. – Lee Loftiss Mar 22 '13 at 08:02
  • 1
    @LeeLoftiss There're more options in the dropdown in "Build" tab. You can choose from "Debug", "Release", "Any" or more. – Jeffrey Zhao Mar 22 '13 at 08:06
  • I am looking at the build tab, and there are not any dropdowns with these options. I am using C# VS2010. – Lee Loftiss Mar 22 '13 at 08:09
  • @LeeLoftiss I have added picture, In that you can see the debug directory from available options. – Sachin Mar 22 '13 at 08:12
  • Thanks. I think perhaps it is important to know I am using the Express version. Sorry, I didn't think about this piece of info when I posted the question. – Lee Loftiss Mar 22 '13 at 08:14
0

The Output path is stored in the .cproj file. One for each configuration.

Open ur *project_Name.csproj* in any editor (say notepad)

For Debug:

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
    .....
    <OutputPath>myOutput\</OutputPath>

</PropertyGroup>

Similarly For Release:

 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
    ...
     <OutputPath>bin\Release\</OutputPath>
</PropertyGroup>

You could try manually editing the OutputPath.

The Output Path can take both Relative and Absolute paths.

Note: The Relative OutputPath should be relative to your project directory (project_Name.csproj) .

jacob aloysious
  • 2,547
  • 15
  • 16