Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Executing a cake script leads to System.IO.FileNotFoundException for several System.(...) assemblies #3823

Closed
2 tasks done
AndreasHennig opened this issue Feb 22, 2022 · 6 comments · Fixed by #3856
Closed
2 tasks done
Assignees
Labels
Milestone

Comments

@AndreasHennig
Copy link

AndreasHennig commented Feb 22, 2022

Prerequisites

  • I have written a descriptive issue title
  • I have searched issues to ensure it has not already been reported

Cake runner

Cake .NET Tool

Cake version

2.1.0

Operating system

macOS

Operating system architecture

64-Bit

CI Server

running locally

What are you seeing?

When executing a very simple cake script (passing a concrete target), the task in the cake script is not executed at all. Using the --verbosity=diagnostic option it shows that it seems to try to compile the script (see output log), but cannot find several assemblies from the System.(...) namespace.

I may should mention that I'm working on a Apple silicon based mac using the supported x64 variants of .NET Core 3.1, .NET 5 and .NET 6 (since I'm developing Xamarin apps and these are the variants Visual Studio For Mac installs automatically).

Environment:

dotnet --info

Result:

.NET SDK (reflecting any global.json):
 Version:   6.0.102
 Commit:    02d5242ed7

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  12.2
 OS Platform: Darwin
 RID:         osx.12-x64
 Base Path:   /usr/local/share/dotnet/x64/sdk/6.0.102/

Host (useful for support):
  Version: 6.0.2
  Commit:  839cdfb0ec

.NET SDKs installed:
  3.1.416 [/usr/local/share/dotnet/x64/sdk]
  5.0.405 [/usr/local/share/dotnet/x64/sdk]
  6.0.102 [/usr/local/share/dotnet/x64/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 3.1.22 [/usr/local/share/dotnet/x64/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.14 [/usr/local/share/dotnet/x64/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.2 [/usr/local/share/dotnet/x64/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.22 [/usr/local/share/dotnet/x64/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.14 [/usr/local/share/dotnet/x64/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.2 [/usr/local/share/dotnet/x64/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download

What is expected?

I would expect the passed target/task to run and in the case of the example build.cake file to simply output Cleaning... using the Information(...) function.

build.cake file:

Task("Clean")
    .Does(() => 
    {
        Information("Cleaning...");
    });

Steps to Reproduce

  1. dotnet tool install cake.tool

Result:

You can invoke the tool from this directory using the following commands: 'dotnet tool run dotnet-cake' or 'dotnet dotnet-cake'.
Tool 'cake.tool' (version '2.1.0') was successfully installed. Entry is added to the manifest file [SolutionDir]/.config/dotnet-tools.json.

dotnet-tools.json in solution folder:

{
  "version": 1,
  "isRoot": true,
  "tools": {
    "cake.tool": {
      "version": "2.1.0",
      "commands": [
        "dotnet-cake"
      ]
    }
  }
}
  1. dotnet tool run dotnet-cake --target=Clean --verbosity=diagnostic

Output log

Looking for modules...
No modules found to install.
Module directory does not exist.
Analyzing build script...
Analyzing [SolutionDir]/build.cake...
Processing build script...
Resolving assembly 'System.Security.Permissions, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' using runtime installed at '/usr/local/share/dotnet/x64/shared/Microsoft.NETCore.App/6.0.2/'...
Exception occurred while resolving assembly System.Security.Permissions: Could not load file or assembly 'System.Security.Permissions, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.

Assembly 'System.Security.Permissions, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' not resolved
Failed to load mscorlib.dll
System.IO.FileNotFoundException: Could not load file or assembly 'System.Security.Permissions, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.

File name: 'System.Security.Permissions, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
   at System.Reflection.RuntimeAssembly.InternalLoad(ObjectHandleOnStack assemblyName, ObjectHandleOnStack requestingAssembly, StackCrawlMarkHandle stackMark, Boolean throwOnFileNotFound, ObjectHandleOnStack assemblyLoadContext, ObjectHandleOnStack retAssembly)
   at System.Reflection.RuntimeAssembly.InternalLoad(AssemblyName assemblyName, RuntimeAssembly requestingAssembly, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, AssemblyLoadContext assemblyLoadContext)
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
   at Cake.Infrastructure.Scripting.ReferenceAssemblyResolver.<GetReferenceAssemblies>g__TryGetReferenceAssemblies|2_0()+MoveNext() in C:\projects\cake\src\Cake\Infrastructure\Scripting\ReferenceAssemblyResolver.cs:line 55
Resolving assembly 'System.Threading.AccessControl, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' using runtime installed at '/usr/local/share/dotnet/x64/shared/Microsoft.NETCore.App/6.0.2/'...
Exception occurred while resolving assembly System.Threading.AccessControl: Could not load file or assembly 'System.Threading.AccessControl, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.

Assembly 'System.Threading.AccessControl, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' not resolved
Failed to load mscorlib.dll
System.IO.FileNotFoundException: Could not load file or assembly 'System.Threading.AccessControl, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.

File name: 'System.Threading.AccessControl, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
   at System.Reflection.RuntimeAssembly.InternalLoad(ObjectHandleOnStack assemblyName, ObjectHandleOnStack requestingAssembly, StackCrawlMarkHandle stackMark, Boolean throwOnFileNotFound, ObjectHandleOnStack assemblyLoadContext, ObjectHandleOnStack retAssembly)
   at System.Reflection.RuntimeAssembly.InternalLoad(AssemblyName assemblyName, RuntimeAssembly requestingAssembly, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, AssemblyLoadContext assemblyLoadContext)
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
   at Cake.Infrastructure.Scripting.ReferenceAssemblyResolver.<GetReferenceAssemblies>g__TryGetReferenceAssemblies|2_0()+MoveNext() in C:\projects\cake\src\Cake\Infrastructure\Scripting\ReferenceAssemblyResolver.cs:line 55
Resolving assembly 'System.Configuration.ConfigurationManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' using runtime installed at '/usr/local/share/dotnet/x64/shared/Microsoft.NETCore.App/6.0.2/'...
Exception occurred while resolving assembly System.Configuration.ConfigurationManager: Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.

Assembly 'System.Configuration.ConfigurationManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' not resolved
Failed to load System.Configuration.dll
System.IO.FileNotFoundException: Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.

File name: 'System.Configuration.ConfigurationManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
   at System.Reflection.RuntimeAssembly.InternalLoad(ObjectHandleOnStack assemblyName, ObjectHandleOnStack requestingAssembly, StackCrawlMarkHandle stackMark, Boolean throwOnFileNotFound, ObjectHandleOnStack assemblyLoadContext, ObjectHandleOnStack retAssembly)
   at System.Reflection.RuntimeAssembly.InternalLoad(AssemblyName assemblyName, RuntimeAssembly requestingAssembly, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, AssemblyLoadContext assemblyLoadContext)
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
   at Cake.Infrastructure.Scripting.ReferenceAssemblyResolver.<GetReferenceAssemblies>g__TryGetReferenceAssemblies|2_0()+MoveNext() in C:\projects\cake\src\Cake\Infrastructure\Scripting\ReferenceAssemblyResolver.cs:line 55
Failed to load System.Configuration.dll
System.IO.FileNotFoundException: Could not load file or assembly 'System.Security.Permissions, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.

File name: 'System.Security.Permissions, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
   at System.Reflection.RuntimeAssembly.InternalLoad(ObjectHandleOnStack assemblyName, ObjectHandleOnStack requestingAssembly, StackCrawlMarkHandle stackMark, Boolean throwOnFileNotFound, ObjectHandleOnStack assemblyLoadContext, ObjectHandleOnStack retAssembly)
   at System.Reflection.RuntimeAssembly.InternalLoad(AssemblyName assemblyName, RuntimeAssembly requestingAssembly, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, AssemblyLoadContext assemblyLoadContext)
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
   at Cake.Infrastructure.Scripting.ReferenceAssemblyResolver.<GetReferenceAssemblies>g__TryGetReferenceAssemblies|2_0()+MoveNext() in C:\projects\cake\src\Cake\Infrastructure\Scripting\ReferenceAssemblyResolver.cs:line 55
Resolving assembly 'System.Diagnostics.EventLog, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' using runtime installed at '/usr/local/share/dotnet/x64/shared/Microsoft.NETCore.App/6.0.2/'...
Exception occurred while resolving assembly System.Diagnostics.EventLog: Could not load file or assembly 'System.Diagnostics.EventLog, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.

Assembly 'System.Diagnostics.EventLog, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' not resolved
Failed to load System.Core.dll
System.IO.FileNotFoundException: Could not load file or assembly 'System.Diagnostics.EventLog, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.

File name: 'System.Diagnostics.EventLog, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
   at System.Reflection.RuntimeAssembly.InternalLoad(ObjectHandleOnStack assemblyName, ObjectHandleOnStack requestingAssembly, StackCrawlMarkHandle stackMark, Boolean throwOnFileNotFound, ObjectHandleOnStack assemblyLoadContext, ObjectHandleOnStack retAssembly)
   at System.Reflection.RuntimeAssembly.InternalLoad(AssemblyName assemblyName, RuntimeAssembly requestingAssembly, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, AssemblyLoadContext assemblyLoadContext)
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
   at Cake.Infrastructure.Scripting.ReferenceAssemblyResolver.<GetReferenceAssemblies>g__TryGetReferenceAssemblies|2_0()+MoveNext() in C:\projects\cake\src\Cake\Infrastructure\Scripting\ReferenceAssemblyResolver.cs:line 55
Resolving assembly 'System.Diagnostics.PerformanceCounter, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' using runtime installed at '/usr/local/share/dotnet/x64/shared/Microsoft.NETCore.App/6.0.2/'...
Exception occurred while resolving assembly System.Diagnostics.PerformanceCounter: Could not load file or assembly 'System.Diagnostics.PerformanceCounter, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.

Assembly 'System.Diagnostics.PerformanceCounter, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' not resolved
Failed to load System.Core.dll
System.IO.FileNotFoundException: Could not load file or assembly 'System.Diagnostics.PerformanceCounter, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.

File name: 'System.Diagnostics.PerformanceCounter, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
   at System.Reflection.RuntimeAssembly.InternalLoad(ObjectHandleOnStack assemblyName, ObjectHandleOnStack requestingAssembly, StackCrawlMarkHandle stackMark, Boolean throwOnFileNotFound, ObjectHandleOnStack assemblyLoadContext, ObjectHandleOnStack retAssembly)
   at System.Reflection.RuntimeAssembly.InternalLoad(AssemblyName assemblyName, RuntimeAssembly requestingAssembly, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, AssemblyLoadContext assemblyLoadContext)
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
   at Cake.Infrastructure.Scripting.ReferenceAssemblyResolver.<GetReferenceAssemblies>g__TryGetReferenceAssemblies|2_0()+MoveNext() in C:\projects\cake\src\Cake\Infrastructure\Scripting\ReferenceAssemblyResolver.cs:line 55
Resolving assembly 'System.Data.SqlClient, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' using runtime installed at '/usr/local/share/dotnet/x64/shared/Microsoft.NETCore.App/6.0.2/'...
Exception occurred while resolving assembly System.Data.SqlClient: Could not load file or assembly 'System.Data.SqlClient, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.

Assembly 'System.Data.SqlClient, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' not resolved
Failed to load System.Data.dll
System.IO.FileNotFoundException: Could not load file or assembly 'System.Data.SqlClient, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.

File name: 'System.Data.SqlClient, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
   at System.Reflection.RuntimeAssembly.InternalLoad(ObjectHandleOnStack assemblyName, ObjectHandleOnStack requestingAssembly, StackCrawlMarkHandle stackMark, Boolean throwOnFileNotFound, ObjectHandleOnStack assemblyLoadContext, ObjectHandleOnStack retAssembly)
   at System.Reflection.RuntimeAssembly.InternalLoad(AssemblyName assemblyName, RuntimeAssembly requestingAssembly, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, AssemblyLoadContext assemblyLoadContext)
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
   at Cake.Infrastructure.Scripting.ReferenceAssemblyResolver.<GetReferenceAssemblies>g__TryGetReferenceAssemblies|2_0()+MoveNext() in C:\projects\cake\src\Cake\Infrastructure\Scripting\ReferenceAssemblyResolver.cs:line 55
Failed to load System.Data.dll
System.IO.FileNotFoundException: Could not load file or assembly 'System.Security.Permissions, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.

File name: 'System.Security.Permissions, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
   at System.Reflection.RuntimeAssembly.InternalLoad(ObjectHandleOnStack assemblyName, ObjectHandleOnStack requestingAssembly, StackCrawlMarkHandle stackMark, Boolean throwOnFileNotFound, ObjectHandleOnStack assemblyLoadContext, ObjectHandleOnStack retAssembly)
   at System.Reflection.RuntimeAssembly.InternalLoad(AssemblyName assemblyName, RuntimeAssembly requestingAssembly, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, AssemblyLoadContext assemblyLoadContext)
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
   at Cake.Infrastructure.Scripting.ReferenceAssemblyResolver.<GetReferenceAssemblies>g__TryGetReferenceAssemblies|2_0()+MoveNext() in C:\projects\cake\src\Cake\Infrastructure\Scripting\ReferenceAssemblyResolver.cs:line 55
Resolving assembly 'System.Data.Odbc, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' using runtime installed at '/usr/local/share/dotnet/x64/shared/Microsoft.NETCore.App/6.0.2/'...
Exception occurred while resolving assembly System.Data.Odbc: Could not load file or assembly 'System.Data.Odbc, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.

Assembly 'System.Data.Odbc, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' not resolved
Failed to load System.Data.dll
System.IO.FileNotFoundException: Could not load file or assembly 'System.Data.Odbc, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.

File name: 'System.Data.Odbc, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
   at System.Reflection.RuntimeAssembly.InternalLoad(ObjectHandleOnStack assemblyName, ObjectHandleOnStack requestingAssembly, StackCrawlMarkHandle stackMark, Boolean throwOnFileNotFound, ObjectHandleOnStack assemblyLoadContext, ObjectHandleOnStack retAssembly)
   at System.Reflection.RuntimeAssembly.InternalLoad(AssemblyName assemblyName, RuntimeAssembly requestingAssembly, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, AssemblyLoadContext assemblyLoadContext)
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
   at Cake.Infrastructure.Scripting.ReferenceAssemblyResolver.<GetReferenceAssemblies>g__TryGetReferenceAssemblies|2_0()+MoveNext() in C:\projects\cake\src\Cake\Infrastructure\Scripting\ReferenceAssemblyResolver.cs:line 55
Resolving assembly 'System.Data.OleDb, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' using runtime installed at '/usr/local/share/dotnet/x64/shared/Microsoft.NETCore.App/6.0.2/'...
Exception occurred while resolving assembly System.Data.OleDb: Could not load file or assembly 'System.Data.OleDb, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.

Assembly 'System.Data.OleDb, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' not resolved
Failed to load System.Data.dll
System.IO.FileNotFoundException: Could not load file or assembly 'System.Data.OleDb, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.

File name: 'System.Data.OleDb, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
   at System.Reflection.RuntimeAssembly.InternalLoad(ObjectHandleOnStack assemblyName, ObjectHandleOnStack requestingAssembly, StackCrawlMarkHandle stackMark, Boolean throwOnFileNotFound, ObjectHandleOnStack assemblyLoadContext, ObjectHandleOnStack retAssembly)
   at System.Reflection.RuntimeAssembly.InternalLoad(AssemblyName assemblyName, RuntimeAssembly requestingAssembly, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, AssemblyLoadContext assemblyLoadContext)
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
   at Cake.Infrastructure.Scripting.ReferenceAssemblyResolver.<GetReferenceAssemblies>g__TryGetReferenceAssemblies|2_0()+MoveNext() in C:\projects\cake\src\Cake\Infrastructure\Scripting\ReferenceAssemblyResolver.cs:line 55
Resolving assembly 'System.CodeDom, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' using runtime installed at '/usr/local/share/dotnet/x64/shared/Microsoft.NETCore.App/6.0.2/'...
Exception occurred while resolving assembly System.CodeDom: Could not load file or assembly 'System.CodeDom, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.

Assembly 'System.CodeDom, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' not resolved
Failed to load System.dll
System.IO.FileNotFoundException: Could not load file or assembly 'System.CodeDom, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.

File name: 'System.CodeDom, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
   at System.Reflection.RuntimeAssembly.InternalLoad(ObjectHandleOnStack assemblyName, ObjectHandleOnStack requestingAssembly, StackCrawlMarkHandle stackMark, Boolean throwOnFileNotFound, ObjectHandleOnStack assemblyLoadContext, ObjectHandleOnStack retAssembly)
   at System.Reflection.RuntimeAssembly.InternalLoad(AssemblyName assemblyName, RuntimeAssembly requestingAssembly, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, AssemblyLoadContext assemblyLoadContext)
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
   at Cake.Infrastructure.Scripting.ReferenceAssemblyResolver.<GetReferenceAssemblies>g__TryGetReferenceAssemblies|2_0()+MoveNext() in C:\projects\cake\src\Cake\Infrastructure\Scripting\ReferenceAssemblyResolver.cs:line 55
Resolving assembly 'Microsoft.Win32.SystemEvents, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' using runtime installed at '/usr/local/share/dotnet/x64/shared/Microsoft.NETCore.App/6.0.2/'...
Exception occurred while resolving assembly Microsoft.Win32.SystemEvents: Could not load file or assembly 'Microsoft.Win32.SystemEvents, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.

Assembly 'Microsoft.Win32.SystemEvents, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' not resolved
Failed to load System.dll
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Win32.SystemEvents, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.

File name: 'Microsoft.Win32.SystemEvents, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
   at System.Reflection.RuntimeAssembly.InternalLoad(ObjectHandleOnStack assemblyName, ObjectHandleOnStack requestingAssembly, StackCrawlMarkHandle stackMark, Boolean throwOnFileNotFound, ObjectHandleOnStack assemblyLoadContext, ObjectHandleOnStack retAssembly)
   at System.Reflection.RuntimeAssembly.InternalLoad(AssemblyName assemblyName, RuntimeAssembly requestingAssembly, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, AssemblyLoadContext assemblyLoadContext)
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
   at Cake.Infrastructure.Scripting.ReferenceAssemblyResolver.<GetReferenceAssemblies>g__TryGetReferenceAssemblies|2_0()+MoveNext() in C:\projects\cake\src\Cake\Infrastructure\Scripting\ReferenceAssemblyResolver.cs:line 55
Failed to load System.dll
System.IO.FileNotFoundException: Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.

File name: 'System.Configuration.ConfigurationManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
   at System.Reflection.RuntimeAssembly.InternalLoad(ObjectHandleOnStack assemblyName, ObjectHandleOnStack requestingAssembly, StackCrawlMarkHandle stackMark, Boolean throwOnFileNotFound, ObjectHandleOnStack assemblyLoadContext, ObjectHandleOnStack retAssembly)
   at System.Reflection.RuntimeAssembly.InternalLoad(AssemblyName assemblyName, RuntimeAssembly requestingAssembly, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, AssemblyLoadContext assemblyLoadContext)
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
   at Cake.Infrastructure.Scripting.ReferenceAssemblyResolver.<GetReferenceAssemblies>g__TryGetReferenceAssemblies|2_0()+MoveNext() in C:\projects\cake\src\Cake\Infrastructure\Scripting\ReferenceAssemblyResolver.cs:line 55
Failed to load System.dll
System.IO.FileNotFoundException: Could not load file or assembly 'System.Diagnostics.PerformanceCounter, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.

File name: 'System.Diagnostics.PerformanceCounter, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
   at System.Reflection.RuntimeAssembly.InternalLoad(ObjectHandleOnStack assemblyName, ObjectHandleOnStack requestingAssembly, StackCrawlMarkHandle stackMark, Boolean throwOnFileNotFound, ObjectHandleOnStack assemblyLoadContext, ObjectHandleOnStack retAssembly)
   at System.Reflection.RuntimeAssembly.InternalLoad(AssemblyName assemblyName, RuntimeAssembly requestingAssembly, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, AssemblyLoadContext assemblyLoadContext)
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
   at Cake.Infrastructure.Scripting.ReferenceAssemblyResolver.<GetReferenceAssemblies>g__TryGetReferenceAssemblies|2_0()+MoveNext() in C:\projects\cake\src\Cake\Infrastructure\Scripting\ReferenceAssemblyResolver.cs:line 55
Failed to load System.dll
System.IO.FileNotFoundException: Could not load file or assembly 'System.Diagnostics.EventLog, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.

File name: 'System.Diagnostics.EventLog, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
   at System.Reflection.RuntimeAssembly.InternalLoad(ObjectHandleOnStack assemblyName, ObjectHandleOnStack requestingAssembly, StackCrawlMarkHandle stackMark, Boolean throwOnFileNotFound, ObjectHandleOnStack assemblyLoadContext, ObjectHandleOnStack retAssembly)
   at System.Reflection.RuntimeAssembly.InternalLoad(AssemblyName assemblyName, RuntimeAssembly requestingAssembly, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, AssemblyLoadContext assemblyLoadContext)
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
   at Cake.Infrastructure.Scripting.ReferenceAssemblyResolver.<GetReferenceAssemblies>g__TryGetReferenceAssemblies|2_0()+MoveNext() in C:\projects\cake\src\Cake\Infrastructure\Scripting\ReferenceAssemblyResolver.cs:line 55
Failed to load System.dll
System.IO.FileNotFoundException: Could not load file or assembly 'System.Security.Permissions, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.

File name: 'System.Security.Permissions, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
   at System.Reflection.RuntimeAssembly.InternalLoad(ObjectHandleOnStack assemblyName, ObjectHandleOnStack requestingAssembly, StackCrawlMarkHandle stackMark, Boolean throwOnFileNotFound, ObjectHandleOnStack assemblyLoadContext, ObjectHandleOnStack retAssembly)
   at System.Reflection.RuntimeAssembly.InternalLoad(AssemblyName assemblyName, RuntimeAssembly requestingAssembly, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, AssemblyLoadContext assemblyLoadContext)
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
   at Cake.Infrastructure.Scripting.ReferenceAssemblyResolver.<GetReferenceAssemblies>g__TryGetReferenceAssemblies|2_0()+MoveNext() in C:\projects\cake\src\Cake\Infrastructure\Scripting\ReferenceAssemblyResolver.cs:line 55
Resolving assembly 'System.IO.Ports, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' using runtime installed at '/usr/local/share/dotnet/x64/shared/Microsoft.NETCore.App/6.0.2/'...
Exception occurred while resolving assembly System.IO.Ports: Could not load file or assembly 'System.IO.Ports, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.

Assembly 'System.IO.Ports, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' not resolved
Failed to load System.dll
System.IO.FileNotFoundException: Could not load file or assembly 'System.IO.Ports, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.

File name: 'System.IO.Ports, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
   at System.Reflection.RuntimeAssembly.InternalLoad(ObjectHandleOnStack assemblyName, ObjectHandleOnStack requestingAssembly, StackCrawlMarkHandle stackMark, Boolean throwOnFileNotFound, ObjectHandleOnStack assemblyLoadContext, ObjectHandleOnStack retAssembly)
   at System.Reflection.RuntimeAssembly.InternalLoad(AssemblyName assemblyName, RuntimeAssembly requestingAssembly, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, AssemblyLoadContext assemblyLoadContext)
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
   at Cake.Infrastructure.Scripting.ReferenceAssemblyResolver.<GetReferenceAssemblies>g__TryGetReferenceAssemblies|2_0()+MoveNext() in C:\projects\cake\src\Cake\Infrastructure\Scripting\ReferenceAssemblyResolver.cs:line 55
Resolving assembly 'System.Windows.Extensions, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' using runtime installed at '/usr/local/share/dotnet/x64/shared/Microsoft.NETCore.App/6.0.2/'...
Exception occurred while resolving assembly System.Windows.Extensions: Could not load file or assembly 'System.Windows.Extensions, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.

Assembly 'System.Windows.Extensions, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' not resolved
Failed to load System.dll
System.IO.FileNotFoundException: Could not load file or assembly 'System.Windows.Extensions, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
(...)
(Had to remove similar lines here since otherwise the issue would be to long)
(...)
Compiling build script...
@devlead
Copy link
Member

devlead commented Feb 22, 2022

Do you have a RunTarget in your script? i.e.

RunTarget(Argument("target", "Default"));

@AndreasHennig
Copy link
Author

AndreasHennig commented Feb 22, 2022

Do you have a RunTarget in your script?

I don't...I'm so sorry for missing out on this. When I add RunTarget(...) to my build script it works perfectly - thank you for your super quick reply on this.

For context: I actually always thought the RunTarget(...) command at the end of a cake script only is necessary to define a default target. I assumed that if I always pass a concrete target, this should just work (which obviously is not the case). I had this assumption since I looked at this page in the docs and just expected it to work.

Does the documentation say something about what RunTarget(...) actually does and why it is necessary? I couldn't find anything. Maybe we could add some kind of info box that indicates that to have RunTarget(...) in a cake script is actually mandatory to make it work?

Thanks for all the great work you and the team are doing!

Oh, and just for the record: The Exception occurred while resolving assembly System.Security.Permissions: Could not load file or assembly 'System.Security.Permissions errors still appear when executing the cake script, but this does not seem to be a problem.

@TheNr1Guest
Copy link

I have the same errors showing in my verbose log also. The script runs fine, but it does not sit well with me seeing these errors as it did not show these using version 1.0.0.

Can someone confirm this is intended (showing this with verbosity=diagnostic) or is this actually an issue?

@devlead
Copy link
Member

devlead commented Feb 24, 2022

I have the same errors showing in my verbose log also. The script runs fine, but it does not sit well with me seeing these errors as it did not show these using version 1.0.0.

Can someone confirm this is intended (showing this with verbosity=diagnostic) or is this actually an issue?

I would say this isn't the intended behavior, in 2.0 we added support for correctly referencing reference assemblies too, which solved several historical issues. Just need to investigate if assemblies should be excluded or logs suppressed in some way.

@HeikeHofmann
Copy link

Additional info, because we have the same issue. We have .NET 6.0.3 installed.
And we get for example this error message with some more info:
(i checked the folder and all this warned assemblies are not located in this directory)

Resolving assembly 'System.Security.Permissions, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' using runtime installed at 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\6.0.3'...
Exception occurred while resolving assembly System.Security.Permissions: Could not load file or assembly 'System.Security.Permissions, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
Assembly 'System.Security.Permissions, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' not resolved

I dont know, why Cake.Tool 2.1.0 is searching in this directory. I can't solve the problem and it blocks our Builds. So this issue is Prio1.

@devlead devlead self-assigned this Apr 2, 2022
@devlead devlead added the Bug label Apr 2, 2022
@devlead devlead added this to the v2.2.0 milestone Apr 2, 2022
devlead added a commit to devlead/cake that referenced this issue Apr 2, 2022
devlead added a commit that referenced this issue Apr 2, 2022
GH3823: Only load valid versioned assmblies
@cake-build-bot
Copy link

🎉 This issue has been resolved in version v2.2.0 🎉

The release is available on:

Your GitReleaseManager bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants