我正在尝试为每个用户更改构建的输出路径。我想将输出重定向到 Ram 磁盘。经过多次尝试,我完成了类似的事情:
<?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>
但是项目名称是硬编码的!为了改变这种情况,我尝试了另一种解决方案:
<OutputPath>R:\VisualStudioBuilds\$(ProjectName)\bin\$(Configuration)\</OutputPath>
这不起作用。最后构建路径是R:\VisualStudioBuilds\bin\Debug
. 我还尝试了其他变量,如ProjectDir
,RootNameSpace
和 other 但仍然没有成功。
我该怎么做才能让它发挥作用?请记住,任何修改都应该在 .csproj.user 中,而不是团队共享的 .csproj。
我该怎么做才能让它发挥作用?请记住,任何修改都应该在 .csproj.user 中,而不是在团队共享的 .csproj 中。
很抱歉延迟回复,但希望这可以给您一些帮助。
要解决此问题,您可以使用 property$(AssemblyName)
而不是$(ProjectName)
,因此 中的设置.csproj.user
如下所示:
<?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>
那应该适合你。
希望这可以帮助。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句