Skip to content

[Bug] FileNotFoundException: The file or assembly "System.Runtime, Version = 5.0.0.0" or a dependency on it was not found. #2518

@SeppPenner

Description

@SeppPenner

Describe the bug

When building my project with the latest GitVersion.MsBuild and after the workaround described in #2502 (I have added the following snippet as fallback for the C:\Users\Nutzer\.nuget\packages\gitversion.msbuild\5.6.1\tools\GitVersion.MsBuild.props file):

<PropertyGroup Condition="'$(GitVersionFileExe)' == ''">
    <GitVersionFileExe>dotnet $(MSBuildThisFileDirectory)net5.0/gitversion.dll</GitVersionFileExe>
    <GitVersionAssemblyFile>$(MSBuildThisFileDirectory)net5.0/GitVersion.MsBuild.dll</GitVersionAssemblyFile>
</PropertyGroup>

In the command line, the build runs properly when using dotnet build.

Expected Behavior

The build in Visual Studio should just work normally.

Actual Behavior

Build fails with error message:

FileNotFoundException: The file or assembly "System.Runtime, Version = 5.0.0.0, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a" or a dependency on it was not found. The system can not find the stated file.
    at GitVersion.MsBuild.GitVersionTasks.BuildServiceProvider (GitVersionTaskBase task)
    at GitVersion.MsBuild.GitVersionTasks.ExecuteGitVersionTask [T] (T task, Action`1 action) in D:\a\GitVersion\GitVersion\src\GitVersion.MsBuild\GitVersionTasks.cs: line 24.
ExampleProject C:\Users\Users\.nuget\packages\gitversion.msbuild\5.6.1\tools\GitVersion.MsBuild.targets

Fun fact: I have no idea why it wants to access the folder D:\a\GitVersion\ (D is my secondary drive which is used for nothing at all at the moment and the folder called a doesn't even exist).

Possible Fix

No idea.

Steps to Reproduce

I have upgraded my projects from netcoreapp3.1 to net5.0 and switched from GitVersionTask to GitVersion.MsBuild. The project is an ASP.Net Blazor server side project (If this is relevant).

Context

Regular / daily work.

Your Environment

  • ASP.Net Blazor server side project.
  • GitVersion.MsBuild Version: 5.6.1
  • Net Version: .Net 5.0
  • ASP.NET Core libraries version: 5.0.1
  • Visual Studio Community 2019, 16.8.30804.86
  • dotnet --info:
.NET SDK (gemäß "global.json"):
 Version:   5.0.101
 Commit:    d05174dc5a

Laufzeitumgebung:
 OS Name:     Windows
 OS Version:  10.0.19041
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\5.0.101\

Host (useful for support):
  Version: 5.0.1
  Commit:  b02e13abab

.NET SDKs installed:
  2.1.806 [C:\Program Files\dotnet\sdk]
  3.1.201 [C:\Program Files\dotnet\sdk]
  3.1.202 [C:\Program Files\dotnet\sdk]
  3.1.300 [C:\Program Files\dotnet\sdk]
  3.1.402 [C:\Program Files\dotnet\sdk]
  5.0.100 [C:\Program Files\dotnet\sdk]
  5.0.101 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.All 2.1.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions