MSBuild Tools 2017 with Azure SDK 2.9.6

Yes, there is a similar question, but they are not related to VS 2017:

I recently upgraded from VS 2015 to VS 2017. Everything works fine on my local developer's computer, and the Azure application (with Azure SDK 2.9.6) builds and runs.

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

MSB4019: Imported project "C: \ Program Files (x86) \ Microsoft Visual Studio \ 2017 \ build tool \ 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.

Build Server / MSBuild tries to find 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 really is 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 meanings: "Community", "Professional", "Enterprise"

Yes, I have 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 got another error in my F # project:

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

It seems that the new MS Build Tools 2017 is not working properly with Windows Azure. Are there any workarounds? Or is this the only option to switch to an older MSBuild?

+5
source share
1 answer

The new stand-alone BuildTools does not currently support Windows Azure targets. Therefore, if you want to use the new MSBuild 2017 with the Azure SDK, you need to install the full installation of VS 2017 on your build server.

Note. You may need to restart TeamCity (agents) in order to recognize the MSBuild path. After starting the build, you can see the MSBuild paths used in the tab options:

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 a flag:

/p:VisualStudioVersion=15.0

for the MSBuild task.

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

+4
source

Source: https://habr.com/ru/post/1265547/


All Articles