assemblies

Load assembly doesn't worked correctly

亡梦爱人 提交于 2019-12-12 07:50:07
问题 I try to load a assembly into my source code in C#. So i first compile the source file: private bool testAssemblies(String sourceName) { FileInfo sourceFile = new FileInfo(sourceName); CodeDomProvider provider = null; bool compileOk = false; // Select the code provider based on the input file extension. if (sourceFile.Extension.ToUpper(CultureInfo.InvariantCulture) == ".CS") { provider = CodeDomProvider.CreateProvider("CSharp"); } else if (sourceFile.Extension.ToUpper(CultureInfo

CodeDom - Linking multiple classes within a single Assembly

匆匆过客 提交于 2019-12-12 06:39:24
问题 I have a C# application that I am trying to re-create through the use of CodeDom. This application has four classes inside of it. If I were to go into this applications directory, I would find the project file (App.csproj), and if I were to start this project file, all four classes would load together. Furthermore, if I were to build this application, all four classes would build together. My Question: How on earth can I create this functionality through the use of CodeDom? I have sucessfully

C# - Loading image from file resource in different assembly

帅比萌擦擦* 提交于 2019-12-12 02:57:09
问题 C# - Loading image from file resource in different assembly I have a PNG image file which is stored in a project called SomeProject and displayed various times using XAML in that same project. In a different assembly, I now wish to access that same image. Previously I was simply specifying a relative path to the actual file which worked fine. However, when I build a release installer, the image files are packed into the SomeProject.DLL. Is there any easy way I can access the PNG file from

How do I import referenced projects into exe?

做~自己de王妃 提交于 2019-12-12 02:43:00
问题 I have a console application which is referencing other projects in solution. When I build it, it will copy those dlls in Debug. I want to import them in the exe. If I add them to resources then load from there, they are not updated. I lose the changes on referenced DLLs. Is there a way that I can build them and import them in the executable file on each build? 回答1: You can use ILMerge to merge several assemblies into one. 回答2: Jeffrey Richter has an article on this very topic: http://blogs

Copying/Moving App Code to New Project

纵然是瞬间 提交于 2019-12-12 02:24:27
问题 Ok, I am in the process of breaking apart of intranet application (VS 2010 Web Site, ASP.NET Web Forms with VB code behind). During this process i'm trying to convert some of our our app_code files in to WCF rest service in a new project. However, when I copy or "add existing" vb files into the new "services" project. I get tons of errors including... error BC30002: Type 'XXX' is not defined warning BC40056: Namespace or type specified in the Imports 'System.ServiceModel' doesn't contain any

How is the .net referenced assemblies names resolved by the clr at runtime?

有些话、适合烂在心里 提交于 2019-12-12 01:26:33
问题 when my .net exe runs, it loads the correct .net assemblies at rumtime. i understand that there is a probing process that happens. my question is that if i open up the .net exe/dll in ildasm, i only the .extern reference to the mscorlib.dll, not others. so how does clr gets the information required for doing the probing of the .net referenced assemlies? i have an example project and the images here. so in this case, i dont see the .net assembly references anywhere like System, System.Xml.Linq

ClickOnce - Overwriting content files

寵の児 提交于 2019-12-11 19:32:34
问题 I have a solution that is deployed using ClickOnce. It consists of an application, several referenced assemblies and a SQL Server Compact database. There is also an assembly which is not referenced by the main application, but simply loaded at runtime. This assembly needs to be deployed along with the application, in the same directory as the application binaries. I set up Visual Studio to copy the "plugin" assembly to the \bin\debug (or \bin\release) directory of the UI project after

Casting back to derived class from base class using Reflections

与世无争的帅哥 提交于 2019-12-11 18:01:36
问题 Here what I am trying to do: BaseClass base = (BaseClass) AppDomain.CurrentDomain.CreateInstance("DerivedClassDLL","DerivedClass"); However, there is a property I need to reach from DerivedClass to display, etc. BaseClass doesn't have that property and I cannot make it happen. So somehow I need to cast it back to DerivedClass to reach it BUT DerivedClass isn't referenced so I cannot reach it is type easily unlike BaseClass which has reference so I can use it. How can I accomplish this? 回答1:

when referencing assemblies, is it possible to insist on a version number but ignore the publickeytoken? (ie accept signed/unsigned)

我的未来我决定 提交于 2019-12-11 13:03:03
问题 As per the question, Is it possible to specify a reference to another assembly, requiring a specific version but not insisting on a specific publickeytoken? My gut feel is no (since I'm guessing when versions are specified, the entire fully qualified assembly name is used which includes both version AND pkt) So if I have this scenario: v1.0 of Assembly A (unsigned) v1.0 of Assembly B that requires v1.0 of Assembly A Can I, without the source code, re-sign the assemblies (via ildasm + ilasm)

Referenced Assembly won't load

[亡魂溺海] 提交于 2019-12-11 12:13:10
问题 I've got a visual studio 2010 project which publishes an assembly called myAssembly.ddl . I then want to reference myAssembly.dll from an existing vs 2008 project. If I try to load the reference it comes up with an yellow exclamation mark next to it, suggesting that the assembly wasn't loaded. However, I'm not getting any error messages during that process. Obviously, if i try to import the namespace in my code it doesn't compile. Converting myAssembly.dll to a .net version 3.5 doesn help.