Jump to content

could not load file or assembly


Recommended Posts

in my mod assembly, I'm referencing a .NET library not native to KSP, but when I run the mod, the debug output says it could not find, load file or assembly.
even coping the .NET dll to the mod folder fails.

any workarounds?

Edited by Xyphos
Link to comment
Share on other sites

10 hours ago, linuxgurugamer said:

Assuming the name of the dll is:   nonNative.dll

In your AssemblyInfo.cs add the following:


[assembly: KSPAssemblyDependency("nonNative", 0, 0, 1)]

 

thanks, but I'm using VS2019 and for some reason, AssemblyInfo.cs is missing, targeting "net45" framework

Link to comment
Share on other sites

Update: so as annoying as it is, I made a bone-headed move by creating the solution under the wrong platform (.NET standard instead of .NET framework)
and tried to fix it by editing the csproj file to correct the mistake, this in turn screwed my project up from the very start where certain options weren't available, disabled or otherwise unused.

sending the whole project to the recycle bin and starting over fixed the problem. thanks.

Edited by Xyphos
Link to comment
Share on other sites

4 hours ago, Xyphos said:

Update: so as annoying as it is, I made a bone-headed move by creating the solution under the wrong platform (.NET standard instead of .NET framework)
and tried to fix it by editing the csproj file to correct the mistake, this in turn screwed my project up from the very start where certain options weren't available, disabled or otherwise unused.

sending the whole project to the recycle bin and starting over fixed the problem. thanks.

It's happened to me as well.  What I do is then create a new project, and copy over all my files, other than the csproj

Link to comment
Share on other sites

@linuxgurugamer  Sorry to keep bugging, but my KSP.log now says:

[LOG 02:34:27.568] AssemblyLoader: Loading assemblies
[WRN 02:34:27.569] AssemblyLoader: Assembly 'RemotingTest' has not met dependency 'System.Runtime.Remoting' V0.0.1
[WRN 02:34:27.570] AssemblyLoader: Assembly 'RemotingTest' is missing 1 dependencies
[ERR 02:34:27.627] AssemblyLoader: Exception loading 'System.Runtime.Remoting': System.BadImageFormatException

 

also, in AssemblyInfo.cs

[assembly: KSPAssemblyDependency("System.Runtime.Remoting", 0, 0, 1)]

 

Edited by Xyphos
Link to comment
Share on other sites

I'm starting to think there's no way to add a reference to System.Runtime.Remoting?

KSP log now says:

ADDON BINDER: Cannot resolve assembly: System.Runtime.Remoting

 

Edit: if not, I still have options:

1. Try a late-load wrapper with reflection (PITA)
2. Implement my own remoting methods (Lots of work)

Edited by Xyphos
Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...