question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Wrapped msbuild for .net core project using paket on linux causes System.TypeLoadException

See original GitHub issue

Description

On Ubuntu while building projects using .net core I get:

error MSB4018: System.TypeLoadException: Could not load type of field 'Microsoft.NET.Build.Tasks.DependencyContextBuilder:_filteredPackages' (12) due to: Could not resolve type with token 01000027 from typeref (expected class 'NuGet.Packaging.Core.PackageIdentity' in assembly 'NuGet.Packaging, Version=5.0.0.6, Culture=neutral, PublicKeyToken=31bf3856ad364e35') assembly:NuGet.Packaging, Version=5.0.0.6, Culture=neutral, PublicKeyToken=31bf3856ad364e35 type:NuGet.Packaging.Core.PackageIdentity member:(null)

see travis build

The environment from travis:

0.01s$ mono --version
Mono JIT compiler version 5.18.1.0 (tarball Fri Mar 15 20:45:47 UTC 2019)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           __thread
	SIGSEGV:       altstack
	Notifications: epoll
	Architecture:  amd64
	Disabled:      none
	Misc:          softdebug 
	Interpreter:   yes
	LLVM:          yes(600)
	Suspend:       preemptive
	GC:            sgen (concurrent by default)
1.20s$ msbuild /version
Copyright (C) Microsoft Corporation. All rights reserved.
16.0.0.0
0.26s$ dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   2.2.202
 Commit:    8a7ff6789d
Runtime Environment:
 OS Name:     ubuntu
 OS Version:  16.04
 OS Platform: Linux
 RID:         ubuntu.16.04-x64
 Base Path:   /usr/share/dotnet/sdk/2.2.202/

@A-Manning also experienced the issue on Ubuntu 18.04.2 x86_64 for .net core 2.2.202

Repro steps

A non minimal reproduction step would be to build the following project elastic-studies at specific commit

Expected behavior

The expected behavior would be that paket builds the project (since that can be done with dotnet cli) on linux

Actual behavior

The wrapped msbuild step in paket fails with TypeLoadException.

Known workarounds

Skip paket and use .net cli directly

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
tomilchikcommented, Apr 25, 2019

Baby steps… Following the note above re: Mono.NuGet (4) vs SDK.NuGet (5) I downloaded the NuGet 5 (following these instructions: ([https://docs.microsoft.com/en-us/nuget/install-nuget-client-tools]) , and aliased nuget to point to the newly downloaded version. This fixed msbuild issue: I can now run msbuild MySolution.sln. Build from VS-Community is still failing. Investigating further…

0reactions
inosikcommented, Apr 24, 2019

Looks like this issue is going to bubble up more often in the upcoming weeks/months: NuGet/Home#7956.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ASP.NET Core System.TypeLoadException Thrown When ...
ASP.NET Core System.TypeLoadException Thrown When Loading View ... My project.json file looks like this so far: { "dependencies": { "Microsoft.
Read more >
Can't get paket to work for the simplest case : r/fsharp
Hello, no matter what I try I cannot seem to get paket to work (ie, I cannot get my console application to use...
Read more >
Paket and the .NET SDK / .NET Core CLI tools (dotnet CLI ...
Paket provides support for .NET SDK-based projects that are used with the dotnet CLI (running with .NET Core) or with MSBuild 15 (Visual...
Read more >
Untitled
Makes creating and manipulating Word files a … Sarwar Abdullah - CEO - XCEED Bangladesh Ltd. LinkedIn WebAug 7, 2020 · I have...
Read more >
Getting Started with Paket – Part 1 - The Cockney Coder
A powerful resolver means that Paket will protect you from accidentally creating incompatible dependency chains – something that can often occur ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found