assembly-resolution

System.BadImageFormatException occurred when build in Release Mode

一曲冷凌霜 提交于 2019-12-31 02:57:06
问题 I am referencing an exe file in a dll. When run in DEBUG mode everything runs fine but when run in Release mode below exception is thrown System.BadImageFormatException occurred HResult=-2147024885 Message=Could not load file or assembly 'Presensoft.InlineMarker, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format. Source=Presensoft.ApplicationServer FileName=Presensoft.InlineMarker, Version=1.0.0.0,

MsBuild does not look in the good directory for custom task's second-level dependencies

♀尐吖头ヾ 提交于 2019-12-30 06:42:06
问题 I wrote a MsBuild Task : MyTask. In my solution, I have the Task project and others projects. MyTask references a project (say ProjA) which references third assemblies, say (dep1 and dep2). The projects all builds well and I have the outputs in one directory (Compil). In this directory i have all the dll's I want : MyTask.dll, ProjA.dll, dep1.dll, dep2.dll and others. In my MsBuild file i include the custom task assembly with : <UsingTask AssemblyFile="..\Compil\MyTask.dll" TaskName=

Assembly Binding Error: Bind result: hr = 0x80070002. The system cannot find the file specified

谁说我不能喝 提交于 2019-12-30 06:11:45
问题 I have a Visual Studio 2010 solution that contains a class library (ProjectA) and two Sharepoint projects (ProjectB & ProjectC). The dependency order is ProjectB references ProejctA and ProjectC references both ProjectA & ProjectB. On one particular development machine i get the following error when trying to build ProjectC: Compilation failed. Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information. When looking into the fusion log i

Multiple search paths for assemblies not in the GAC when using REGASM & COM

♀尐吖头ヾ 提交于 2019-12-25 01:08:57
问题 I am in the process of creating a .NET assembly that will be registered for COM so that it can be referenced by Microsoft Excel VBA. The assembly references a third-party .NET assembly (that contains some useful classes) that is not in the GAC, however, I have a problem with the deployment of my assembly since the path to the third-party assembly is not always in the same location (it depends on the locale of the user as well as how recently the third-party assembly was installed). This means

Loading Assemblies

女生的网名这么多〃 提交于 2019-12-23 22:25:55
问题 There are plenty of discussing that shows how to load assemblies from BIN and from GAC... my question is more general and I would love to know how assembly loading work. As for example in the BIN folder we can have A.dll A.dll.config A.dll.config file can look like: <?xml version="1.0"?> <configuration> <startup> <supportedRuntime version="v2.0.50727"/> </startup> </configuration> to help us setting the correct assembly reference. I was wondering how can I create a A.dll that needs B.dll but

Making binding redirects work for office add-ins

拥有回忆 提交于 2019-12-23 10:49:31
问题 I'm using Microsoft.Bcl.Async in my Word addin, my addin is compiled as an exe (test_addin.exe) file, that is loaded as an assembly from Microsoft Word, when I start the executable directly, everything's working fine, but when I run it from Word, I'm getting an error saying that it failed to load the Systems.Threading.Tasks assembly. Could not load file or assembly System.Threading.Tasks... It looks like that its related to the binding redirects, when I try to run the application from Word it

Drawbacks, advantages, etc. between ILMerge or ResolveAssembly for embedding assemblies?

。_饼干妹妹 提交于 2019-12-22 06:56:57
问题 Currently I know of two methods of embedding assemblies into one application file: ILMerge and using the ResolveAssembly event. I would like to know if anyone have had more success with one over the other. Is there any drawbacks from using either one of those (performance, security, ...)? From my point of view, it looks like we should always merge all the "private" assemblies into an application as it is more clean this way when the application is considered as a whole. Any thoughts? 回答1: I

How to provide a fallback assembly instead of the one that can't be loaded?

Deadly 提交于 2019-12-22 04:49:13
问题 At runtime, if a referenced assembly fails to load with e.g. "Strong name validation failed" (because it's test-signed), is there a way to provide a substitution assembly from another path that is real-signed? I tried subscribing to AppDomain.CurrentDomain.AssemblyResolve, but it doesn't get fired, because the "bad" assembly technically exists, it just can't be loaded. Is there a generic way to provide a fallback assembly when an assembly can't be loaded? 回答1: I think you can just call

Is it possible to create a binding redirect at runtime?

笑着哭i 提交于 2019-12-21 17:34:42
问题 Once an application has started is there a way to create a binding redirect that will apply to all future assembly loads? 回答1: It could be possible using ICLRHostBindingPolicyManager::ModifyApplicationPolicy, but I've never tried myself. Note that this is a CLR-level interface, so you can't load policies for individual AppDomains (which is why it is not used by PostSharp yet). http://msdn.microsoft.com/en-us/library/ms164378.aspx 回答2: Sorry for responding to an old post, but this blog has a

Exception with Resolving assemblies: Attempt to load an unverifiable executable with fixups

老子叫甜甜 提交于 2019-12-18 18:47:21
问题 I'm embedding required assemblies to my project and resolving them on runtime with AppDomain.CurrentDomain.AssemblyResolve event. All works okay except irrKlang's .net4-wrapper, which throws an exception if i try so; System.IO.FileLoadException: Attempt to load an unverifiable executable with fixups (IAT with more than 2 sections or a TLS section.) (Exception from HRESULT: 0x80131019) at System.Reflection.RuntimeAssembly.nLoadImage(Byte[] rawAssembly, Byte[] rawSymbolStore, Evidence evidence,