C # - "Resources" DLL cannot be loaded since it does not exist - how can I find a link to delete it?

I have a C # solution that rips out executable binary when compiling. The binary file depends on the library, which is the product of another solution that I wrote, to all the code I created.

Recently, I played with several project settings in a rather random way, trying to understand how the CLR connection works. Unfortunately (predictably?) I managed to break the link to my binary, but I'm not sure how to fix this problem.

  • When I have my binary, I get the following feedback before the application crashes.

Loading assemblies ........ Failed to add types to assembly MY.Library, Version = 1.0.0.0, Culture = neutral, PublicKeyToken = null - Failed to load one or more of the requested types. Extract the LoaderExceptions Property for more info.

  • The following is a merge log for the MY.Library.resources library. The specified binary does not exist, and I do not know where and why it is trying to download.
<P β†’
All probing URLs attempted and failed *** Assembly Binder Log Entry (22/04/2011 @ 10:34:17) *** The operation failed. Bind result: hr = 0x80070002. The system cannot find the file specified. Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll Running under executable G:\SVN\dev\Debug\MYExecutable.exe --- A detailed error log follows. === Pre-bind state information === LOG: User = UBERIT\gavina LOG: DisplayName = MY.Library.resources, Version=1.0.0.0, Culture=en, PublicKeyToken=null (Fully-specified) LOG: Appbase = file:///G:/SVN/dev/Debug LOG: Initial PrivatePath = x64 LOG: Dynamic Base = NULL LOG: Cache Base = NULL LOG: AppName = MYExecutable.exe Calling assembly : MY.Library, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null. === LOG: This bind starts in default load context. LOG: Using application configuration file: G:\BuildSVN\apps\ExecSys\MYExecutable\dev\Debug\MYExecutable.exe.Config LOG: Using host configuration file: LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config. LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind). LOG: Attempting download of new URL file:///G:/SVN/dev/Debug/en/MY.Library.resources.DLL. LOG: Attempting download of new URL file:///G:/SVN/dev/Debug/en/MY.Library.resources/MY.Library.resources.DLL. LOG: Attempting download of new URL file:///G:/SVN/dev/Debug/x64/en/MY.Library.resources.DLL. LOG: Attempting download of new URL file:///G:/SVN/dev/Debug/x64/en/MY.Library.resources/MY.Library.resources.DLL. LOG: Attempting download of new URL file:///G:/SVN/dev/Debug/en/MY.Library.resources.EXE. LOG: Attempting download of new URL file:///G:/SVN/dev/Debug/en/MY.Library.resources/MY.Library.resources.EXE. LOG: Attempting download of new URL file:///G:/SVN/dev/Debug/x64/en/MY.Library.resources.EXE. LOG: Attempting download of new URL file:///G:/SVN/dev/Debug/x64/en/MY.Library.resources/MY.Library.resources.EXE. LOG: All probing URLs attempted and failed. 
  • Are Resource DLLs Implicit? Or do I have a link to this DLL? How to find the link in the SLN for the library?

TL DR

  • How to remove a link to non-existent DLL resources?
+4
source share
3 answers
  • Are Resource DLLs Implicit? Or do I have a link to this DLL? How to find the link in the SLN for the library?
  • How to remove a link to non-existent DLL resources?

Resox is actually built into your dll. You do not need to refer to it. The reason you see "library.resouce" is because your code asks .net to load the assembly manually, although app.config or AppDomain.AssemblyResolve .

In your case, I think this is the last. Just find this event handler and do something like this:

 static System::Reflection::Assembly^ HandleAssemblyResolveEvent(System::Object^ sender, System::ResolveEventArgs^ args) { System::String^ assemblyName = args->Name->Substring(0, args->Name->IndexOf(",")); if(assemblyName->EndsWith(".resources")) return nullptr; } 

The code is in C ++ \ CLI, but it is easy to translate it to C #.

+3
source

I just had such a problem, Visual Studio 2010 could not find all kinds of DLL resources, such as xaml.resources.dll and presentationcore.resources.dll. It turns out (in the end) that was the result of the fact that I moved MainWindow.xaml to a subfolder. I don’t know if this is the same with window forms, but for those who are doing WPF there: DO NOT MOVE MainWindow.xaml. Another day of my life is gone.

+1
source

Typically, your reference DLLs should be located in the References folder in your C # project (you must also add external DLLs there). You can right-click on the DLL you want to release and click Remove .

0
source

All Articles