使用vars为每个用户设置Visual Studio 2017的输出构建路径 [英] Set output build path for Visual Studio 2017 per user with vars

查看:120
本文介绍了使用vars为每个用户设置Visual Studio 2017的输出构建路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试更改每个用户构建的输出路径.我想将输出重定向到Ram Disk.经过多次尝试,我完成了类似的事情:

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>

这不起作用.最后,构建路径为R:\VisualStudioBuilds\bin\Debug.我还尝试了另一个变量,例如ProjectDirRootNameSpace和其他变量,但仍然没有成功.

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.

我应该怎么做才能使其正常工作?请记住,任何修改都应该在.csproj.user中,而不是团队共享的.csproj.

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

推荐答案

我应该怎么做才能使其正常工作? 请记住,任何修改都应该在.csproj.user中,而不要与团队共享.csproj .

很抱歉延迟回复,但希望能为您提供帮助.

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

要解决此问题,可以使用属性 $(AssemblyName) 代替$(ProjectName),因此.csproj.user中的设置如下:

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>

应该适合您.

希望这会有所帮助.

这篇关于使用vars为每个用户设置Visual Studio 2017的输出构建路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆