assemblies

Controlling how P/Invoked assemblies are loaded into different app domains

我怕爱的太早我们不能终老 提交于 2019-12-11 10:25:45
问题 I've got an application which needs to call some unmanaged code in a dll. I need to do these calls from multiple app domains and specifically want the assembly to be loaded into memory multiple times (once per app domain). I've tried doing the following: Dim AppDomainSetup As New AppDomainSetup With AppDomainSetup .PrivateBinPath = "<Blah>" .LoaderOptimization = LoaderOptimization.MultiDomainHost End With Dim AppDomain As AppDomain = AppDomain.CreateDomain(String.Format("AppDomain-{0}",

Add reference problem in silverlight: You can't add a reference to dll as it was not built against the silverlight runtime

≡放荡痞女 提交于 2019-12-11 09:25:41
问题 I have a silverlight application which has a class library project in it. th class library is running in .Net framework 4 and the silverlight project is running in silverlight 3. when I want to add a reference in the silverlight proj to the class library I get this message: "You can't add a reference to Classlibrary1.dll as it was not built against the silverlight runtime. silverlight project will only work with silverlight asseblies." I've tried to change the framework the classlibrary1 used

How to detect if another assembly is available to my application or not

会有一股神秘感。 提交于 2019-12-11 07:48:42
问题 I have a command line winforms executable that calls into a Windows winforms application. Occassionally Ops forget to include the windows exe with the command line exe when deploying the application, leading to an error. How do I gracefully handle that and show a nice error instead of: Unhandled Exception: System.IO.FileNotFoundException: Could not load file or ass embly 'MyappFoo, Version=5.1.4303.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the

Load and execute code from an assembly without locking the file?

吃可爱长大的小学妹 提交于 2019-12-11 07:38:58
问题 Is there a way to load an assembly from disk and execute code in it without getting the file locked on disk? I never understood why it is necessary to lock the file since the code will be loaded in RAM and JIT-compiled? 回答1: It's possible, you can use Assembly.Load(byte[]) to load an assembly as well. That assembly doesn't have a "loading context", you can load it repeatedly. Managing this is however not easy, you're bound to find out. 回答2: What you are looking for is called shadow copying.

How to include source code location information (file/line/column) in .NET assembly?

倖福魔咒の 提交于 2019-12-11 06:47:36
问题 I need to be able to get from .NET assembly a class/struct/interface definition location (filename,begin_line,begin_column,end_line,end_column) in my source files. First solution that came to my mind was using some pdb quering api, but it seems that I can obtain such info only for method definition this way. Or maybe I'm wrong... To provide the context, i'm trying to build an add-in to VS 2008 which compiles all solution projects through VS automation model, takes assemblies and using

Assembly looking for wrong version of Newtonsoft.Json.dll

安稳与你 提交于 2019-12-11 06:26:27
问题 My project is using Newtonsoft.Json.dll. I have added the dll as a reference to my project and im using version 8.0.2 Everything works on my pc however when i transfer everything to a new pc along with Newtonsoft.Json.dll i get the error Could not load file or assembly 'Newtonsoft.Json‚ Version=4.0.3.0‚ Culture=neutral‚ PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified. Im not referencing that version anywhere and there is nothing in my app

How to retrieve info on a loaded assembly at runtime? (c# , .NET)

三世轮回 提交于 2019-12-11 06:21:17
问题 In .NET c# 3.5 I have a console application (A) that references several assemblies(X, Y, Z). How can I get the version information of the loaded assemblies at run time? I can use reflection to get the info on the currently executing assembly like this System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString() but not the loaded assemblies. Thanks for your help! 回答1: JP's answer will give you all of the assemblies in the AppDomain. If you only want the assemblies that your

Suppress MessageBox from a referenced assembly

拥有回忆 提交于 2019-12-11 06:19:35
问题 How do I suppress a MessageBox from showing that comes from a reference to an assembly that I do not own (nor have the code for)? For example, my application (MyApplication.exe) is referencing an assembly coded by someone else (SomeoneElsesAssembly.dll). Inside of this assembly I'm calling a static method, which does what it's supposes to, but also is firing a MessageBox that I want to suppress. I thought there was a way to reference an assembly in Non-Interactive mode or something along

TFS: “Could not load type ' ' from assembly” - but only shows sometimes

主宰稳场 提交于 2019-12-11 06:15:59
问题 In my solution, I run my unit tests and they all pass. When I then commit via TFS then sometimes the following shows in the TFS build step regarding one of the projects: Could not load type 'Castle.Proxies.HttpContextProxy' from assembly 'DynamicProxyGenAssembly2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=xxx' Why is the error only showing sometimes? I've checked all the Assembly Names under 'Application' tab of properties in VS as suggested in "Could not load type from assembly error"

Is there a way to force MonoDevelop to build/load an assembly?

拈花ヽ惹草 提交于 2019-12-11 06:15:15
问题 I have a MonoTouch application which is managing a list of assemblies. I want developers to be able to modify that list of assemblies as easily as possible. I was hoping that I could just have them add an assembly to the application's references, and that I could then loop through them like this: foreach (AssemblyName assemblyName in this.GetType().GetReferencedAssemblies()) { Assembly assembly = Assembly.Load(assemblyName); //Do something with assembly } The problem that I'm having is that