assemblies

Can I sign an assembly for which I do not have source code?

泄露秘密 提交于 2019-12-03 15:50:19
问题 I have received an assembly from a third party. I need to add it to the GAC, but it does not have a strong name. Is there any way for me to sign the assembly using my own key so that it will be strong named? 回答1: Yes. You can use ILDASM to disassemble the assembly into CIL code, and use ILAsm to reassemble that CIL code and sign it with your own key. I've done this with various third-party assemblies, and it works just fine. The post .NET-fu: Signing an Unsigned Assembly (Without Delay

Determining if an assembly is part of the .NET framework

断了今生、忘了曾经 提交于 2019-12-03 15:46:39
问题 How can I tell from the assembly name, or assembly class (or others like it), whether an assembly is part of the .NET framework (that is, System.windows.Forms )? So far I've considered the PublicKeyToken, and CodeBase properties, but these are not always the same for the whole framework. The reason I want this information is to get a list of assemblies that my EXE file is using that need to be on client machines, so I can package the correct files in a setup file without using the Visual

.NET: Serializing object to a file from a 3rd party assembly (to make Selenium WebDriver faster)

人走茶凉 提交于 2019-12-03 14:53:44
End Goal for serializing FirefoxDriver (my question here) = making WebDriver faster!! Below is a link that describes how to serialize an object. But it requires you implement from ISerializable for the object you are serializing. What I'd like to do is serialize an object that I did not define--an object based on a class in a 3rd party assembly (from a project reference) that is not implementing ISerializable . Is that possible? How can this be done? http://www.switchonthecode.com/tutorials/csharp-tutorial-serialize-objects-to-a-file Property (IWebDriver = interface type): private IWebDriver

How to tell if a .NET assembly is dynamic?

﹥>﹥吖頭↗ 提交于 2019-12-03 14:21:18
问题 When iterating through a set of assemblies, e.g. AppDomain.CurrentDomain.GetAssemblies(), dynamic assemblies will throw a NotSuportedException if you try to access properties like CodeBase. How can you tell that an assembly is dynamic without triggering and catching the NotSupportedException? 回答1: To check if the assembly is dynamic: if (assembly.ManifestModule is System.Reflection.Emit.ModuleBuilder) This took me a while to figure out, so here it is asked and answered. Update: In .NET 4.0,

.Net Dynamically Load DLL

拜拜、爱过 提交于 2019-12-03 12:52:51
问题 I am trying to write some code that will allow me to dynamically load DLLs into my application, depending on an application setting. The idea is that the database to be accessed is set in the application settings and then this loads the appropriate DLL and assigns it to an instance of an interface for my application to access. This is my code at the moment: Dim SQLDataSource As ICRDataLayer Dim ass As Assembly = Assembly. _ LoadFrom("M:\MyProgs\WebService\DynamicAssemblyLoading\SQLServer\bin

Load assembly doesn't worked correctly

时光总嘲笑我的痴心妄想 提交于 2019-12-03 12:40:45
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.InvariantCulture) == ".VB") { provider = CodeDomProvider.CreateProvider("VisualBasic"); } else { Console.WriteLine(

WCF extensions without including the assembly version

心不动则不痛 提交于 2019-12-03 12:15:53
问题 As discussed here, I'm trying to add a WCF endpoint-extension; I've got it working, but I need to include the full assembly details: <extensions> <behaviorExtensions> <add name="protobuf" type="ProtoBuf.ServiceModel.ProtoBehaviorExtension, protobuf-net, Version=1.0.0.275, Culture=neutral, PublicKeyToken=257b51d87d2e4d67"/> </behaviorExtensions> </extensions> What I would like to do (to avoid issues when updating etc, especially for samples) is to include just the names: <add name="protobuf"

How can I get all the inherited classes of a base class? [duplicate]

岁酱吖の 提交于 2019-12-03 11:46:02
This question already has answers here : How to find all the types in an Assembly that Inherit from a Specific Type C# (4 answers) Get all derived types of a type (8 answers) class Foo { } class Foo1 : Foo { } class Foo2 : Foo { } How would I be able to get all the classes that use Foo as a base class? The inherited classes aren't necessary in the same assembly. Sam Harwell This is not fast, but as long as Foo is a concrete type (not an interface), then it should work. Foo itself is not returned by this code. AppDomain.CurrentDomain.GetAssemblies() .SelectMany(assembly => assembly.GetTypes())

AppDomain.Unload doesn't release the assembly I loaded up with Reflection [duplicate]

狂风中的少年 提交于 2019-12-03 11:04:22
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: how to delete the pluginassembly after AppDomain.Unload(domain) I am struggling with an issue while loading an assembly up in a temporary AppDomain to read its GetUsedReferences property. Once I do that, I call AppDomain.Unload(tempDomain) and then I try to clean up my mess by deleting the files. That fails because the file is locked. I Unloaded the temporary domain though! Any thoughts or suggestions would be

Assembly File Version not changing?

不羁的心 提交于 2019-12-03 10:56:55
问题 I have in my assemblyinfo.cs class the code: [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyFileVersion("1.0.*")] Calling System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString() works fine and gives the updated version, however, when i look at the generated dll in windows explorer, right click properties, click the 'details' tab, the fileversion says "1.0.0.0" even though the output above says 1.0.3489.17621 ? 回答1: You cannot use 1.0.* to auto-increment the