visual-studio MSBuildExtensionsPath32 设置不正确?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3143413/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 12:10:42  来源:igfitidea点击:

MSBuildExtensionsPath32 not set correctly?

visual-studiodeploymentmsbuild

提问by Jamie Nordmeyer

For the life of me, I cannot find where this value is actually set. It SHOULD be pointing at C:\Program Files\MSBuild, but on our build box, it's pointing at C:. How can I change this?

对于我的生活,我找不到这个值的实际设置位置。它应该指向 C:\Program Files\MSBuild,但在我们的构建框中,它指向 C:。我怎样才能改变这个?

采纳答案by Julien Hoarau

MSBuildExtensionsPath32is set internally by MSBuild. (BuildEngine.BuildPropertyGroup.SetExtensionsPathProperties)

MSBuildExtensionsPath32由 MSBuild 内部设置。( BuildEngine.BuildPropertyGroup.SetExtensionsPathProperties)

But you could override it by setting an environment variable.

但是您可以通过设置环境变量来覆盖它。

SET MSBuildExtensionsPath="C:\Program Files\MSBuild"

Or you could override the value in your project file :

或者您可以覆盖项目文件中的值:

<PropertyGroup>
  <MSBuildExtensionsPath>C:\Users\madgnome\Desktop\msbuild</MSBuildExtensionsPath>

  <!-- It works too with relative path -->
  <!--<MSBuildExtensionsPath>..\msbuild</MSBuildExtensionsPath>-->
</PropertyGroup>

<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />

回答by speckledcarp

This is a very old question, but I ran into a similar issue using MSBuild version 16.0 ("equivalent" to Visual Studio 2019).

这是一个非常古老的问题,但我在使用 MSBuild 16.0 版(“等效于”Visual Studio 2019)时遇到了类似的问题。

In my case I had a commandline option setting the build tools to an older version that didn't exist on my build server.

在我的情况下,我有一个命令行选项将构建工具设置为我的构建服务器上不存在的旧版本。

I had to use /tv:"Current"to get the build to correctly set the MSBuildExtensionsPathvariable

我不得不使用/tv:"Current"构建来正确设置MSBuildExtensionsPath变量