assemblies

How to keep ASP.NET assemblies in AppDomain alive?

霸气de小男生 提交于 2019-11-26 08:58:37
问题 Scenario: I\'ve an n-Tier enterprise ASP.NET application deployed using Web Deployment Projects. All tiers produce independent assemblies that is consumed by the ASP.NET application. Problem: When I run the app. for the first time after deployment it takes lot of time to load dependent assemblies in memory. But once loaded its lighting fast app. In case if there are no users accessing the app, IIS unloads the assemblies from the memory and when a user tried to access the app on a later

How can I get the assembly file version

可紊 提交于 2019-11-26 08:51:32
问题 In AssemblyInfo there are two assembly versions: AssemblyVersion : Specify the version of the assembly being attributed. AssemblyFileVersion : Instructs a compiler to use a specific version number for the Win32 file version resource. The Win32 file version is not required to be the same as the assembly\'s version number. I can get the Assembly Version with the following line of code: Version version = Assembly.GetEntryAssembly().GetName().Version; But how can I get the Assembly File Version ?

How do I merge multiple .net assemblies into a single assembly?

耗尽温柔 提交于 2019-11-26 08:23:12
问题 I have a .net application with about 10 assemblies. It would be nice to have them all together as a single assembly. How do I do it? I guess something like a jar file for Java applications. 回答1: Try ILMerge. NuGet package here 回答2: Using ILMerge is probably the simplest solution. However, ILMerge has the drawback that it changes the identity of referenced assemblies. As a consequence, you might run into issues with security or serialization. An excellent blog post by Simone Busoli discusses

How to load a .NET assembly for reflection operations and subsequently unload it?

≡放荡痞女 提交于 2019-11-26 08:07:48
问题 I\'m writing a tool to report information about .NET applications deployed across environments and regions within my client\'s systems. I\'d like to read the values of assembly attributes in these assemblies. This can be achieved using Assembly.ReflectionOnlyLoad , however even this approach keeps the assembly loaded. The issue here is that I cannot load two assemblies that have the same name from different paths, so naturally I can\'t compare the same application deployed in different

Could not load file or assembly HRESULT: 0x80131515 (When adding controller to MVC project that has assembly references on network drive)

▼魔方 西西 提交于 2019-11-26 07:58:51
问题 I\'ve seen this: VSTS 2010 SGEN : error : Could not load file or assembly (Exception from HRESULT: 0x80131515) and none of the answers work. It also doesn\'t appear when I build or anything. I can run the project fine, it happens when I try to add an entity framework templated controller: Then I get this error: All project files are on my network share because that is where My Documents resides for our work. Here is what I tried: 1) Turning Generator Serialization Assembly in project settings

C#: why sign an assembly?

霸气de小男生 提交于 2019-11-26 07:57:47
问题 In some C# code I have taken over (in Visual Studio 2005), I have noticed that the assemblies are all signed with the same .snk file. Why would the previous author have signed the assemblies in this way? Is signing assemblies necessary and what would be wrong with not signing? What disadvantages are there in signing assemblies - does it cause delays? 回答1: Why would the previous author have signed the assemblies in this way? No idea, maybe he wanted all his assemblies to be signed with the

C#: Custom assembly directory

情到浓时终转凉″ 提交于 2019-11-26 07:35:43
问题 Say we have an application which consists of one executable and 5 libraries. Regularly all of these will be contained in one directory and the libraries will be loaded from there. Is it possible to do so that I can have for example some of the libraries in one directory called Lib, and the rest in one called Lib2? So that the application directory would only contain the executable itself and the other assemblies would be contained in various logical directories. How can I do this? And I would

How to load Assembly at runtime and create class instance?

心已入冬 提交于 2019-11-26 07:35:37
问题 I have a assembly. In this assembly I have a class and interface. I need to load this assembly at runtime and want to create an object of the class and also want to use the interface. Assembly MyDALL = Assembly.Load(\"DALL\"); // DALL is name of my dll Type MyLoadClass = MyDALL.GetType(\"DALL.LoadClass\"); // LoadClass is my class object obj = Activator.CreateInstance(MyLoadClass); This is my code. How could it be improved? 回答1: If your assembly is in GAC or bin use the assembly name at the

Using different versions of the same assembly in the same folder

扶醉桌前 提交于 2019-11-26 06:50:49
I have the following situation Project A - Uses Castle Windsor v2.2 - Uses Project B via WindsorContainer Project B - Uses NHibernate - Uses Castle Windsor v2.1 In the bin folder of Project A I have the dll Castle.DynamicProxy2.dll v2.2 and NHibernate dlls. Now the problem is that NHibernate is dependent on Castle.DynamicProxy2.dll v2.1 which is not there. How do I resolve this situation. I used the following configuration to resolve the issue. <configuration> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="Castle.DynamicProxy2"

Determine framework (CLR) version of assembly

江枫思渺然 提交于 2019-11-26 06:34:33
问题 From the command line (or by any means really), how can I determine which CLR version a .NET assembly requires? I need to determine if an assembly requires 2.0 or 4.0 CLR version. 回答1: ildasm.exe will show it if you double-click on "MANIFEST" and look for "Metadata version". By default, it's the version that the image was compiled against. 回答2: One clarification... The problem with all the mentioned methods is that they will return version 4.0 if assembly was compiled against .NET framework 4