Igorbek/CodeContracts.MSBuild

Error when build with dotnet build

xperiandri opened this issue · 2 comments

%UserName%\.nuget\packages\codecontracts.msbuild\1.13.0-rc\Contracts\MsBuild\vCurrent\Microsoft.CodeContracts.targets(276,5): 
error MSB4062: 
The "Microsoft.Build.Tasks.GetFrameworkSdkPath" task could not be loaded from the assembly Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.  
Confirm that the <UsingTask> 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. 

I tried to copy v15.0 to vCurrent. No result

When building on GitHub

Unhandled Exception:
  System.TypeInitializationException: The type initializer for 'System.Compiler.SystemTypes' threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.Compiler.CoreSystemTypes' threw an exception. ---> System.InvalidCastException: Specified cast is not valid.
    at System.Compiler.CoreSystemTypes.GetSystemAssembly (System.Boolean doNotLockFile, System.Boolean getDebugInfo, System.Compiler.AssemblyNode+PostAssemblyLoadProcessor postAssemblyLoad) [0x00076] in <7c14c9b51c5c4cbbb3359f80fa0ab01d>:0 
    at System.Compiler.CoreSystemTypes.Initialize (System.Boolean doNotLockFile, System.Boolean getDebugInfo, System.Compiler.AssemblyNode+PostAssemblyLoadProcessor postAssemblyLoad) [0x0002b] in <7c14c9b51c5c4cbbb3359f80fa0ab01d>:0 
    at System.Compiler.CoreSystemTypes..cctor () [0x00000] in <7c14c9b51c5c4cbbb3359f80fa0ab01d>:0 
     --- End of inner exception stack trace ---
    at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_generic_class_init(intptr)
    at System.Compiler.SystemTypes.Initialize (System.Boolean doNotLockFile, System.Boolean getDebugInfo, System.Compiler.AssemblyNode+PostAssemblyLoadProcessor postAssemblyLoad) [0x00027] in <7c14c9b51c5c4cbbb3359f80fa0ab01d>:0 
    at System.Compiler.SystemTypes..cctor () [0x00000] in <7c14c9b51c5c4cbbb3359f80fa0ab01d>:0 
     --- End of inner exception stack trace ---
    at Microsoft.Contracts.Foxtrot.Driver.Program.InternalMain (System.String[] args) [0x0015a] in <7c14c9b51c5c4cbbb3359f80fa0ab01d>:0 
    at Microsoft.Contracts.Foxtrot.Driver.Program.Main (System.String[] args) [0x0000c] in <7c14c9b51c5c4cbbb3359f80fa0ab01d>:0 
  [ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: The type initializer for 'System.Compiler.SystemTypes' threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.Compiler.CoreSystemTypes' threw an exception. ---> System.InvalidCastException: Specified cast is not valid.
    at System.Compiler.CoreSystemTypes.GetSystemAssembly (System.Boolean doNotLockFile, System.Boolean getDebugInfo, System.Compiler.AssemblyNode+PostAssemblyLoadProcessor postAssemblyLoad) [0x00076] in <7c14c9b51c5c4cbbb3359f80fa0ab01d>:0 
    at System.Compiler.CoreSystemTypes.Initialize (System.Boolean doNotLockFile, System.Boolean getDebugInfo, System.Compiler.AssemblyNode+PostAssemblyLoadProcessor postAssemblyLoad) [0x0002b] in <7c14c9b51c5c4cbbb3359f80fa0ab01d>:0 
    at System.Compiler.CoreSystemTypes..cctor () [0x00000] in <7c14c9b51c5c4cbbb3359f80fa0ab01d>:0 
     --- End of inner exception stack trace ---
    at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_generic_class_init(intptr)
    at System.Compiler.SystemTypes.Initialize (System.Boolean doNotLockFile, System.Boolean getDebugInfo, System.Compiler.AssemblyNode+PostAssemblyLoadProcessor postAssemblyLoad) [0x00027] in <7c14c9b51c5c4cbbb3359f80fa0ab01d>:0 
    at System.Compiler.SystemTypes..cctor () [0x00000] in <7c14c9b51c5c4cbbb3359f80fa0ab01d>:0 
     --- End of inner exception stack trace ---
    at Microsoft.Contracts.Foxtrot.Driver.Program.InternalMain (System.String[] args) [0x0015a] in <7c14c9b51c5c4cbbb3359f80fa0ab01d>:0 
    at Microsoft.Contracts.Foxtrot.Driver.Program.Main (System.String[] args) [0x0000c] in <7c14c9b51c5c4cbbb3359f80fa0ab01d>:0 
/home/runner/.nuget/packages/codecontracts.msbuild/1.13.0-rc/Contracts/MsBuild/v15.0/Microsoft.CodeContracts.targets(255,5): error MSB3073: The command ""/home/runner/.nuget/packages/codecontracts.msbuild/1.13.0-rc/build/../Contracts/Bin/ccrewrite.exe" "@StringBuilderExtensionsccrewrite.rsp"" exited with code 1. [/home/runner/work/StringBuilderExtensions/StringBuilderExtensions/StringBuilderExtensions/StringBuilderExtensions.csproj]

Tried to build with MSBuild instead of dotnet build on GitHub - same TypeInitializationException