assembly-resolution

How to solve: Custom MSBuild task requires assembly outside of AppBase

假装没事ソ 提交于 2019-12-07 03:10:31
问题 I have a custom Task that I want to execute when building my C# projects. This task is located in MyTask.dll, which references another assembly, MyCommon.DLL. The problem is that MyCommon.dll is located at "..\Common\MyCommon.dll" relative to MyTask.dll, which puts it outside the AppBase dir for MSBuild process. I've confirmed that this is indeed the problem by analyzing MSBuild's log and seeing Fusion's report about the binding failure. What can I do to make Fusion find MyCommon.dll during

Where do I find Microsoft.VisualStudio.DebuggerVisualizers?

♀尐吖头ヾ 提交于 2019-12-07 00:57:19
问题 A project won't compile because of a missing assembly. The file that causes the error has a using Microsoft.VisualStudio.DebuggerVisualizers; The VisualStudio part is marked in red. What do I have to install to fix it? To me it sounds like something that would have come with Visual Studio, but that is what I am using, so it is installed... Clarification: I know what assembly it exists in, and the reference is added earlier to the project references. But how do I get it? What SDK do I have to

how can I embed an assembly into a console application without ILMerge?

怎甘沉沦 提交于 2019-12-06 16:56:57
There are a lot of posts on here about this, I'm using this code from another SO post and placing a delegate assignation in my Main() method. None of the other posts have directly answered my question. I've got my third party assembly embedded as a resource but when I fire up the app: I'm getting a TypeInitializationException with an inner of FileNotFoundException. It's trying to find the assembly on the file system and failing. it's never getting to the Main method, where the event handler for AssemblyResolve is assigned I have two assembly refs that are embedded in my Resources.resx, one is

Windows service locks up on assembly load

痴心易碎 提交于 2019-12-06 04:35:40
I have a Windows Service written in C#. It includes a standalone console mode as well, for debugging purposes. It works fine on almost every computer it's been run on, but we ran into a situation where this service locks up when you try to start it, and then it gets killed because of timeout. But when running it in console mode on the same machine, it starts up fine. It's a pain to debug because I don't actually have access to the machine this is happening on, I have to go through a human proxy. But after a bunch of trial and error debugging, I finally narrowed the cause down to assembly load.

Mimicking assembly resolution of the msbuild process

笑着哭i 提交于 2019-12-06 03:57:37
问题 I am writing a validation tool that checks the versions of files referenced in a project. I want to use the same resolution process that MSBuild uses. For example, Assembly.Load(..) requires a fully-qualified assembly name. However, in the project file, we may only have something like "System.Xml". MSBuild probably uses the project's target framework version and some other heuristics to decide which version of System.Xml to load. How would you go about mimicking (or directly using) msbuild's

How can I dynamically reference an assembly that looks for another assembly?

我是研究僧i 提交于 2019-12-06 02:08:02
问题 Apologies for the dodgy question - happy to rephrase if someone has a better suggestion. I'm trying to create an object by dynamically invoking an assembly belonging to another application. The following PowerShell code is working nicely for me: [Reflection.Assembly]::LoadFrom("C:\Program Files\Vendor\Product\ProductAPI.dll") $bobject = new-object ProductAPI.BasicObject $bobject.AddName("Some Name") I'm struggling to do the same thing in C#. Based on other posts on StackOverflow I currently

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

末鹿安然 提交于 2019-12-05 10:50:59
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? I've since found this blog post from Jeffrey Richter and I think it answers adequately my question. 来源: https:/

How to solve: Custom MSBuild task requires assembly outside of AppBase

◇◆丶佛笑我妖孽 提交于 2019-12-05 06:16:27
I have a custom Task that I want to execute when building my C# projects. This task is located in MyTask.dll, which references another assembly, MyCommon.DLL. The problem is that MyCommon.dll is located at "..\Common\MyCommon.dll" relative to MyTask.dll, which puts it outside the AppBase dir for MSBuild process. I've confirmed that this is indeed the problem by analyzing MSBuild's log and seeing Fusion's report about the binding failure. What can I do to make Fusion find MyCommon.dll during the build process? Note that moving the assembly would break my app, which also depends on it. UPDATE:

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

时光怂恿深爱的人放手 提交于 2019-12-05 04:35:17
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? I think you can just call assembly.LoadFrom to load the assembly of your choice with practically no security checks. We us this a lot at the

Does redirecting assembly binding work for unit testing with a test runner?

与世无争的帅哥 提交于 2019-12-04 09:21:09
问题 Ok, so here's the full description of the problem I'm having: I am trying to use NUnit ExtensionMethods but whenever I run a test containing one of the extension methods using TestDriven.Net or if I just flat out try to load the assembly using a test-runner GUI (Icarus or NUnit) I get a FileNotFoundException. Pounding head against a wall and digging in further I think I know what's wrong. Cue reflector and yep, I can see that NUnit.Framework>ExtensionMethods.dll has a reference to nunit