• If you have a mod, tool or prefab, please use the Resources section. Click Mods at the top of the forums.

V2.0 Experimental: custom NetPackages

Sadler

Refugee
New 7DTD uses ReadOnlySpan<T> in PooledBinaryWriter, which I obviously don't have in .NET Framework 4.x. Should I switch my mod to .NET Standard 2.1 to be able to compile my custom NetPackages again? I guess, It will probably not work.

BTW, I circumvented the problem in a hacky way, but I think it still worth mentioning. I am not sure if it's intentional, or just a bug.
 
Copy the Assembly-CSharp.dll somewhere out of the game folder, open it with dnSpyEx, find the PooledBinaryWriter and remove all the methods that uses ReadOnlySpan. You would probably not want to use them anyway. Now you can use this new binary to compile your mod. Important: do not provide that new Assembly-CSharp.dll with your mod and don't replace the original Assembly-CSharp.dll from the game, it will make it crash. It's only usable for compilation step. And you must repeat the process after 7DTD updates, so it's not the most convenient method.
 
If you add a reference to mscorlib from the game's managed folder it should be able to work out where the ReadOnlySpans live

e.g. in your project file:

Code:
 <Reference Include="mscorlib">
     <HintPath>C:\PathToYourGame\7DaysToDie_Data\Managed\mscorlib.dll</HintPath>
 </Reference>
 
Hmm, I have tried to do it before from the MSVC UI, and it denied to do that. Now just manually added mscorlib.dll and replaced the reference on System.dll to get rid of some namespaces duplicated (like System.Collections.Generic.Queue). Looks like it compiled okay and runs as intended, thank you.
 
Back
Top