Bamboo build fails after upgrading to Visual Studio 2017
Asked by Sebastian Kowalczyk:

Hi there,

we are currently upgrading from VS2013 to VS2017. We are still using .Net 4.0. So what I have done is upgrading all our projects (desktop tools, windows services, wcf sites) and committing them to bitbucket.

At the moment we use an MSBuild task to build the whole project, which points to the following path: C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30.319\\MSBuild.exe.

Building the complete project within a branch with the VS2013 projects works fine. But building another branch, which contains the updated projects (VS2017) does not work anymore. I see several compiler errors like:

```
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3245: Reference could not be resolved
```

```
error BC30002: The type "xyz" is not defined.
```

```
error BC30451: "xyz" is not declared.
```

I already added a new MSBuild executable, which points to C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\MSBuild\\15.0\\Bin after installing the build tools for Visual Studio 2017, but the project sill can't compile without errors:

```
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3088: File "obj\Release\Common.vbprojResolveAssemblyReference.cache" could not be read. The assembly "Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" could not be found.
```

```
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3245: Reference could not be resolved
```

I think the main problem here is that nearly every project has a dependency to another project. Missing references may lead compiler errors.

Compiling the project on my computer by using the Visual Studio developer console works fine. But we want to avoid installing another VS2017 on the build server (to save some money \^\^).

Has anybody had the same problems? I think this is a general configuration error by me. Maybe I have to install some other MS tools or change the configuration?

I would be really glad, if someone can help me out.

Best regards,

Sebastian


Answers:
author: Sebastian Kowalczyk
body: Seems like I managed to solve the problem. When installing the build tools for visual studio 2017, you have to install some more optional components (e.g. Windows 10 SDK) from this setup, which are part of the VC++ workflow, even if you use .Net instead of C++. This creates a folder called "Sdks" in C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\MSBuild, which contains all the necessary files.

The build works then, if you use the new MSBuild reference to C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\MSBuild\\15.0\\Bin in Bamboo.

comments: author: Christian Palacios
body: Hi Sebastian,

We have a similar problem where we get the error below.

**The current .NET SDK does not support targeting .NET Core 2.0. Either target .NET Core 1.1 or lower, or use a version of the .NET SDK that supports .NET Core 2.0.**

We have VS 2017 Community Edition and the solution works just fine using the IDE. Do you know exactly what we should install? The agent is on a Windows 2012 R2 VM.

Thanks!


author: Sebastian Kowalczyk
body: Hi Christian,

because this problem dates back a year now, I can't remember the details. But I think the missing optional component in our case was the correct version of the Windows 10 SDK.

In your case I would try to install the VS tools with the most common components and then start to add more and more (probably fitting) components until your build works in bamboo. This is how I solved the problem pretty fast after being tired of searching.

Best regards,

Sebastian


Tags: .net

ms-build

visual-studio