I have a Visual Studio solution that we have been building with VS 2015 using the Visual Studio Online Build. We want to convert the build to VS 2017. It builds locally for me with no error. However, when building online using the "VS2017 Hosted" build agent it fails with the following error when trying to build my WIX based MSI:
DEV\Setup\UISetup\UISetup.wixproj(56,3): Error MSB4019: The imported project "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\WiX\v3.x\Wix.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
Troubleshooting, the wixproj does have an import statement for this path:
$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets
I put some extra steps in the build and found the following as a comparison of the two build agents:
"Hosted" (build works on this VS 2015 build agent)
wix.targets Is Here: C:\Program Files (x86)\MSBuild\Microsoft\WiX\v3.x\wix.targets
With Diagnostic output on MSBuild, here are the MSBuild property settings
2017-08-19T19:12:13.3864207Z MSBuildExtensionsPath = C:\Program Files (x86)\MSBuild
2017-08-19T19:12:13.3864207Z MSBuildExtensionsPath32 = C:\Program Files (x86)\MSBuild
2017-08-19T19:12:13.3864207Z MSBuildExtensionsPath64 = C:\Program Files\MSBuild
Hosted VS2017 (same build fails on this build agent)
Looking here for wix.targets: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\WiX\v3.x\Wix.targets <-- which errors
But wix.targets is here: C:\Program Files (x86)\MSBuild\Microsoft\WiX\v3.x\wix.targets <-- same as “Hosted” build agent
With Diagnostic output on MSBuild, here are the MSBuild property settings
2017-08-19T19:21:06.5320962Z MSBuildExtensionsPath = C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild <-- Different on this build agent
2017-08-19T19:21:06.5320962Z MSBuildExtensionsPath32 = C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild <-- Different on this build agent
2017-08-19T19:21:06.5320962Z MSBuildExtensionsPath64 = C:\Program Files\MSBuild
I have opened a ticket with Microsoft support, but so far, they have been no help. The real issue is that MSBuildExtensionsPath32 is pointing to a different folder on the "VS2017 Hosted" build agent, but the wix.targets file is in the original folder. I would hate to hard code the path to wix.targets, but I really don't see an alternative.
Any ideas?
Thanks.