Background
A simple dotnet core 2.0 project has a dependency to Xamarin.Forms (2.3.4.270).
When I build the project in Visual Studio 2017 (15.3) then the build succeeds. When running dotnet build
on the command line it fails with the following error:
C:\Users\steph.nuget\packages\xamarin.forms\2.3.4.270\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets(40,3): error MSB4062: The "Xamarin.Forms.Build.Tasks.FixedCreateCSharpManifestResourceName" task could not be loaded from the assembly C:\Users\steph.nuget\packages\xamarin.forms\2.3.4.270\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.Build.Tasks.dll. Could not load file or assembly 'Microsoft.Build.Utilities.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. [C:\Users\steph\Documents\Bitbucket\time-stamp-core\TimeStamp.Core.Views\TimeStamp.Core.Views.csproj]
So for whatever reason Microsoft.Build.Utilities.v4.0
is missing. As you can see in the screenshot above I already tried to add the build utilities as well, without success. Independent on whether Build Core is added or not I'm getting the same result.
.csproj
file:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="15.3.409" />
<PackageReference Include="Xamarin.Forms" Version="2.3.4.270" />
</ItemGroup>
</Project>
Questions
- Where is the difference betweend
dotnet build
and Visual Studio 2017 for building such kind of project? I've been under the impression that VS2017 also just callsdotnet build
. - How can I fix this?