assemblies

Difference between Assembly.CreateInstance and Activator.CreateInstance?

三世轮回 提交于 2019-12-17 18:35:07
问题 What is the difference between these calls? 回答1: None. The Assembly.CreateInstance actually calls Activator.CreateInstance under the hood. Using Reflector on Assembly.CreateInstance: public object CreateInstance(string typeName, bool ignoreCase, BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture, object[] activationAttributes) { Type type = this.GetType(typeName, false, ignoreCase); if (type == null) { return null; } return Activator.CreateInstance(type, bindingAttr,

Do I need to publish the public key from .snk file?

谁都会走 提交于 2019-12-17 16:52:53
问题 From the description of sn.exe utility and this question I see that a copy of the public key is added to every assembly signed with the strong name. This is enough to validate that the assembly binary has not been altered. But how does one verify that given assembly was really signed with some given keypair and compiled by a given company? Anyone could generate his own keypair, produce some assembly and sign it with his keypair. Do I need to publish the public key so that those who want to

Accessing a .NET Assembly from classic ASP

ε祈祈猫儿з 提交于 2019-12-17 16:37:12
问题 I have been trying to access a .NET Assembly that I have created in classic ASP using dim foo set foo = Server.CreateObject("TestAssembly.MyClass") The problem is I'm getting an error: Server object error 'ASP 0177 : 800401f3' Server.CreateObject Failed /test.asp, line 4 Invalid class string I have registered the assembly (TestAssembly.dll) using gacutil and regasm as instructed in the article: Replacing Old Classic ASP COM Components with .NET Assemblies which I referenced from another

Read AssemblyFileVersion from AssemblyInfo post-compile

若如初见. 提交于 2019-12-17 16:22:15
问题 How can one read the AssemblyFileVersion , or its components AssemblyFileMajorVersion , AssemblyFileMinorVersion , AssemblyFileBuildNumber , AssemblyFileRevision , within the .csproj, following compilation? I have tried the following which pulls the information from the built assembly: <Target Name="AfterCompile"> <GetAssemblyIdentity AssemblyFiles="$(TargetPath)"> <Output TaskParameter="Assemblies" ItemName="MyAssemblyIdentities"/> </GetAssemblyIdentity> <Message Text="AssemblyVersion = %

Difference Between Assembly and DLL

耗尽温柔 提交于 2019-12-17 15:23:11
问题 What is the difference between Assembly and a DLL? While sending the code to a remote client, should a DLL file be sent or should a Assembly be sent (When direct TCP connection is available between two)? 回答1: An assembly is .NET's "minimum unit of deployment". Usually an assembly corresponds to a single file, but it doesn't have to - you can have multiple files, with one of them being the master which knows where all the other bits are. Single-file assemblies are usually DLLs or EXE files. If

How to read assembly attributes

隐身守侯 提交于 2019-12-17 10:39:11
问题 In my program, how can I read the properties set in AssemblyInfo.cs: [assembly: AssemblyTitle("My Product")] [assembly: AssemblyDescription("...")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Radeldudel inc.")] [assembly: AssemblyProduct("My Product")] [assembly: AssemblyCopyright("Copyright @ me 2008")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] I'd like to display some of these values to the user of my program, so I'd like to know how to load

Difference between AppDomain.GetAssemblies and BuildManager.GetReferencedAssemblies

ⅰ亾dé卋堺 提交于 2019-12-17 09:22:09
问题 Just wanted to know if there is any difference between the two, in the context of a fully trust asp.net mvc 2 application. 回答1: The .NET Framework defers loading assemblies into the current AppDomain until they're needed. For example, if you call into a third-party library only from SomeMethod(), the third-party DLL normally won't be loaded until the first time SomeMethod() runs. AppDomain.GetAssemblies() gives you all assemblies which have already been loaded into the current AppDomain.

Visual Studio 2010: Reference Assemblies Targeting Higher Framework Version

大憨熊 提交于 2019-12-17 08:50:08
问题 Visual Studio 2008 did let you reference an assembly A from an Assembly B when A was targeting .NET 3.5 and B was targeting .NET 2.0. Visual Studio 2010 doesn't allow for this any more. The full issue is described on MSDN: You can create applications that reference projects or assemblies that target different versions of the .NET Framework. For example, if you create an application that targets the .NET Framework 4 Client Profile, that project can reference an assembly that targets .NET

mscorlib.dll & System.dll

感情迁移 提交于 2019-12-17 08:18:07
问题 Why did MS originally make the decision to maintain these two separate core libs? Maybe they had some scalability issue in mind, but nowadays I never see an application, of any type, that doesn't need both. Does anyone have any inside information on this? It's not really important, but been on my mind for years. PS. I know what's in the two libs, I know the difference - I'm a big fan of Reflector :) Just wondering what practical use the separation of the two has. 回答1: Mscorlib does contains

.Net: Running code when assembly is loaded

限于喜欢 提交于 2019-12-17 04:28:31
问题 Is it possible to run some code when an assembly is loaded, without doing anything specific in the loading code? What I am looking for is like a static constructor on a type. Eg: Assembly A does not know about Assembly B, but B does know about A. Assembly A needs to know certain things about B if B is loaded. When Assembly B is loaded by the runtime (referenced, or explicit), I want a piece of code (static method or attribute) to be executed that calls a method in Assembly A. The root cause