Skip to content

Building using dotnet build fails for .NET Standard library project #1175

Closed
@jpierson

Description

@jpierson

I'm using the latest pre-release of GitVersionTask (4.0.0-beta0011) on a .NET standard library project and it seems to work from Visual Studio 2017 but not from the command line using dotnet build. I'm targeting netstandard1.2.

I wasn't sure whether this would work at all. I started off looking around for an implementation that installs a GitVersion package as a DotnetCliToolReference in an SDK csproj file. With nothing conclusive from that or from other .NET Core related issues (ex. #647) I figured I should just try adding the package reference and see what it does. I was happy at first to see it was working when building the solution from Visual Studio but building using dotnet build gives me the following error.

Microsoft (R) Build Engine version 15.1.545.13942
Copyright (C) Microsoft Corporation. All rights reserved.

C:\Users\me.nuget\packages\gitversiontask\4.0.0-beta0011\build\GitVersionTask.targets(45,5): error MSB4062: The "GitVersionTask.WriteVersionInfoToBuildLog" task could not be loaded from the assembly C:\Users\me.nuget\packages\gitversiontask\4.0.0-beta0011\build\GitVersionTask.dll. Could not load file or assembly 'Microsoft.Build.Utilities.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL'. 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\me\source\myproj\src\MyProj\MyProj.csproj]
C:\Program Files\dotnet\sdk\1.0.0-rc4-004771\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.targets(92,5): error : Cannot find project info for 'C:\Users\me\source\myproj\src\MyProj\MyProj.csproj'. This can indicate a missing project reference. [C:\Users\me\source\myproj\src\TestCore\TestCore.csproj]

Build FAILED.

C:\Users\me.nuget\packages\gitversiontask\4.0.0-beta0011\build\GitVersionTask.targets(45,5): error MSB4062: The "GitVersionTask.WriteVersionInfoToBuildLog" task could not be loaded from the assembly C:\Users\me.nuget\packages\gitversiontask\4.0.0-beta0011\build\GitVersionTask.dll. Could not load file or assembly 'Microsoft.Build.Utilities.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL'. 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\me\source\myproj\src\MyProj\MyProj.csproj]
C:\Program Files\dotnet\sdk\1.0.0-rc4-004771\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.targets(92,5): error : Cannot find project info for 'C:\Users\me\source\myproj\src\MyProj\MyProj.csproj'. This can indicate a missing project reference. [C:\Users\me\source\myproj\src\TestCore\TestCore.csproj]
0 Warning(s)
2 Error(s)

Time Elapsed 00:00:01.09

According to the documentation:

Support for CoreCLR with dotnet build is coming soon.

Is there anywhere I can follow along with the work being done for getting GitVersionTask or some form of automated solution that works for .NET library projects?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions