-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
We use a pattern like the following. At the top of the project is a property and at the bottom the Import/@Project uses that property. Simplified:
<PropertyGroup>
<PathToTargetsFile Condition=" '$(PathToTargetsFile)'==''">
$(MSBuildExtensionsPath32)Our\stuff.targets
</PathToTargetsFile>
<PropertyGroup>
...
<Import Project="$(PathToTargetsFile)" />
This pattern allows our users to set the PathToTargetsFile Property and redirect their build to a private install location for our tools.
With MSBuild15 this creates problems because the $(MSBuildExtensionsPath32) will only point to the private location with MSBuild15 and not fallback to the global location where the tools are installed by default.
We've done the work to create a VS2017 extension to install a "trampoline" stuff.targets inside the private MSBuild15 location out to the global install location. This works inside VS but on a build machine the VS2017 extension may not be installed or the MSBuild Build Tools SKU may be used and extensions are not allowed there.
The best idea we've come up with to address this is to change our template projects file to do the following:
<Import Project="$(PathToTargetsFile)"
Condition=" '$(PathToTargetsFile)'!=' " />
<Import Project="$(MSBuildExtensionsPath32)Our\stuff.targets"
Condition=" '$(PathToTargetsFile)'==''" />
The problem is that change will break all of our existing customers and force them to change all of their project files. 😭
Is there any other option to better handle the breaking change introduced in MSBuild15?