C
C#3y ago
sparr

Why is mscorlib 2.0 an ExplicitReference in the Initial Items when running msbuild? [Answered]

I'm trying to build a project that has some dependencies on mscorlib version 4.0, but something about my build process is pulling in an implicit dependency on version 2.0 so I get a lot of warnings. warning MSB3277: Found conflicts between different versions of "mscorlib" that could not be resolved A possibly useful warning hint is this, which is confusing because I can't tell what's causing the primary setting/selection: "mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" was chosen because it was primary and "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" was not. This is where I'm running msbuild, but the repo is very out of date and I'm working on bringing it up to date: https://github.com/sparr/rimworld-mod-DraggableCorners/tree/master/Source/DraggableCorners question: How can I determine what is causing v2.0 to get included? I've run msbuild -v:diag and find this in the Initial Items:
_ExplicitReference
/usr/lib/mono/2.0-api/mscorlib.dll
_ExplicitReference
/usr/lib/mono/2.0-api/mscorlib.dll
meta-question: is there a better place to ask what is probably a linux-specific tooling/build question?
15 Replies
Cisien
Cisien3y ago
you're going to have a bad time trying to get .net 2 to play nicely with .net 4 rimworld, fwiw, requires .net 3.5 it's probably not that 2.0 is being included, but rather 4.x is @sparr
sparr
sparr3y ago
Here's the top of the warnings
sparr
sparr3y ago
4.0 is being referenced from Rimworld stuff 2.0 is coming from... I don't know where it seems to be saying that /usr/lib/mono/2.0-api/mscorlib.dll is an explicit project file
Cisien
Cisien3y ago
rimworld uses .net 3.5 though which might be the 2.0 mscorlib what framework version are you targeting in your project? that's what determines which mscorlib to pull in
sparr
sparr3y ago
I am not sure. How would I check? <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> Assembly-CSharp is the primary (only?) assembly for rimworld, and the warning says it depends on mscorlib 4.0.0.0
mtreit
mtreit3y ago
.NET 3.5 apps use mscorlib 2.0:
ModLoad: 00007ffb`a2980000 00007ffb`a3864000 C:\WINDOWS\assembly\NativeImages_v2.0.50727_64\mscorlib\e83ea6962e94a4202990444c43c7ca9b\mscorlib.ni.dll
ModLoad: 00007ffb`a2980000 00007ffb`a3864000 C:\WINDOWS\assembly\NativeImages_v2.0.50727_64\mscorlib\e83ea6962e94a4202990444c43c7ca9b\mscorlib.ni.dll
You need to upgrade from .NET Framework 3.5
sparr
sparr3y ago
I don't think I chose that intentionally. It may have been auto generated or copied from another project. I doubt I'm using any 3.5-specific functionality. However, I think other mods for this game are targeting 3.5, since the game uses 3.5(?), and folks compiling on other platforms don't get this error
mtreit
mtreit3y ago
All I can say is that 3.5 is extremely old As @Cisien said, mixing 3.5 and 4.x projects is going to be a recipe for failure.
sparr
sparr3y ago
ok, I can see at least some other mods targeting newer frameworks guess I'll bump up to 4.0 and see if I encounter problems
Cisien
Cisien3y ago
rimworld requires targeting 3.5 it won't work on 4
Cisien
Cisien3y ago
it's on a very old version of unity you can try it I dont think it's gone though an engine upgrade though
sparr
sparr3y ago
thanks for the insights!
Cisien
Cisien3y ago
this is a mod i made back in 2017... no clue if these settings work today though https://github.com/Cisien/NoMoreBreakdownNoise/blob/master/JustFixIt.csproj#L12
GitHub
NoMoreBreakdownNoise/JustFixIt.csproj at master · Cisien/NoMoreBrea...
Contribute to Cisien/NoMoreBreakdownNoise development by creating an account on GitHub.
Accord
Accord2y ago
✅ This post has been marked as answered!
Want results from more Discord servers?
Add your server