30

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?

CJBS
  • 15,147
  • 6
  • 86
  • 135
Jamie Nordmeyer
  • 565
  • 1
  • 7
  • 14

2 Answers2

25

MSBuildExtensionsPath32 is set internally by 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" />
Julien Hoarau
  • 48,964
  • 20
  • 128
  • 117
  • Thanks. I played around with the SET command, and this got me past that error, but introduced another. I think I'm going to pass it off to my architect and see what he comes with. – Jamie Nordmeyer Jul 01 '10 at 16:37
1

This is a very old question, but I ran into a similar issue using MSBuild version 16.0 ("equivalent" to 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 MSBuildExtensionsPath variable

speckledcarp
  • 6,196
  • 4
  • 22
  • 22
  • 1
    Yeah, MSBuild was and is a bit of a hot mess. It's definitely better with .NET Core, though... but I still wish that Microsoft had been able to get the project.json system to work. Alas. – Jamie Nordmeyer Mar 25 '20 at 15:16
  • Yeah, especially since the documentation is incomplete - in the case of the docs I was looking at, `"Current"` wasn't even mentioned as a valid option. They had `4.0` listed as the newest valid option, which was what I was using. – speckledcarp Mar 25 '20 at 15:29