Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MSBuild Tools 2017 with Azure SDK 2.9.6

Yep there are similar question out there, but they are not related to VS 2017:

  • Visual Studio Build - Azure 2.9 SDK
  • MSBuild MSB4096 error with Azure SDK 2.9.1

I've recently upgraded from VS 2015 to VS 2017. On my local dev computer everything works fine and the Azure application (with Azure SDK 2.9.6) builds and starts.

But on the TeamCity server (MS Build Tools 2017 - Tool version 15.0) I get the following error:

MSB4019: The imported project "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Microsoft\VisualStudio\v15.0\Windows Azure Tools\2.9\Microsoft.WindowsAzure.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.

The build server/MSBuild tries to find the Microsoft.WindowsAzure.targets in the directory:

"C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Microsoft\VisualStudio\v15.0\Windows Azure Tools\2.9\

But it is actually in the directory:

"C:\Program Files (x86)\Microsoft Visual Studio\2017\[VisualStudioVersion]\MSBuild\Microsoft\VisualStudio\v15.0\Windows Azure Tools\2.9\

[VisualStudioVersion] can have the following values "Community", "Professional" ,"Enterprise"

Yes, I've the build tools installed (https://www.visualstudio.com/thank-you-downloading-visual-studio/?sku=BuildTools&rel=15 ).

Yes, I already copied the whole Windows Azure Tools folder to BuildTools\MSBuild\Microsoft\VisualStudio\v15.0, but then I get another error in my F# project:

MSB4057: The target "GetTargetFrameworkProperties" does not exist in the project.

It seems like the new MS Build Tools 2017 doesn't work properly with Windows Azure. Are there any workarounds yet? Or is the only option to switch back to an older MSBuild?

like image 801
Robar Avatar asked Mar 16 '17 11:03

Robar


Video Answer


1 Answers

The new standalone BuildTools currently don't support Windows Azure targets. So if you want to use the new MSBuild 2017 with Azure SDK you have to install a full VS 2017 installation on your build server.

Note: You may have to restart the TeamCity (agents) in order to recognize the MSBuild path. After running a build you can see the used MSBuild paths in the tab 'parameters':

MSBuildTools15.0_x64_Path: C:\Program Files (x86)\Microsoft Visual Studio\2017\[VS_VERSION]\MSBuild\15.0\bin\amd64 MSBuildTools15.0_x86_Path: C:\Program Files (x86)\Microsoft Visual Studio\2017\[VS_VERSION]\MSBuild\15.0\bin [VS_VERSION] can be Community, Professional or Enterprise

I still got the GetTargetFrameworkProperties error from the F# project, this was resolved by adding the flag:

/p:VisualStudioVersion=15.0

to the MSBuild task.

For more information see https://github.com/Microsoft/msbuild/issues/1888

like image 200
Robar Avatar answered Oct 20 '22 17:10

Robar