Set output build path for Visual Studio 2017 per user with vars

904 Views Asked by At

I am trying to change the output path for build per user. I want to redirect output to Ram Disk. After many attempts i finished with something like that:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <OutputPath>R:\VisualStudioBuilds\MyProjectName\bin\$(Configuration)\</OutputPath>
  </PropertyGroup>
</Project>

But the project name is hardcoded! To change this situation i have tried another solution:

<OutputPath>R:\VisualStudioBuilds\$(ProjectName)\bin\$(Configuration)\</OutputPath>

And this doesn't work. In the end the build path is R:\VisualStudioBuilds\bin\Debug. I have also tried out another variables like ProjectDir, RootNameSpace and other but still no success.

What should I do to make it work? Remember, any modification should be in .csproj.user not to team-shared .csproj.

2

There are 2 best solutions below

4
On BEST ANSWER

What should I do to make it work? Remember, any modification should be in .csproj.user not to team-shared .csproj.

Sorry for this delayed reply, but hope this can give you some helps.

To accomplish this issue, you can use property $(AssemblyName) instead of $(ProjectName), so the settings in the .csproj.user looks like:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <OutputPath>R:\VisualStudioBuilds\$(AssemblyName)\bin\$(Configuration)\</OutputPath>
  </PropertyGroup>
</Project>

That should be works for you.

Hope this helps.

0
On

The default output directory is :

$(SolutionDir)$(Configuration)\

So by default, output binaries will be created in:

Path\To\Your\Solution\[Configuration]\.

Configuration can be something like "Debug" or "Release".

Depending on your project settings, these directories can vary. You can see/change those settings in :

Menu Project -> Properties -> Configuration Properties -> General -> Output Directory