Questions tagged [assemblies]

Assemblies are collections of compiled .Net types and resources grouped into a logical and physical unit (in the form of a .dll file or .exe file).

Assemblies are collections of compiled .Net types and resources grouped into a logical and physical unit (in the form of a .dll file or a .exe file - which has an entry point).

If a .exe is a .NET assembly then it also contains a CLR header as a data block inside the PE header.

2372 questions
56
votes
12 answers

Using the Web Application version number from an assembly (ASP.NET/C#)

How do I obtain the version number of the calling web application in a referenced assembly? I've tried using System.Reflection.Assembly.GetCallingAssembly().GetName() but it just gives me the dynamically compiled assembly (returning a version number…
David Duffett
  • 3,145
  • 2
  • 26
  • 27
55
votes
10 answers

How can I reference a dll in the GAC from Visual Studio?

This assembly is in the GAC: Microsoft.SqlServer.Management.RegisteredServers.dll How can I add a reference to this assembly in Visual Studio? I can view the file in c:\windows\assembly\
yankman
55
votes
4 answers

What does it really mean to target a framework, and how do I maximize compatibility?

Greetings all, This has confused me ever since I first started coding in C#. My goal is to create an assembly that will run on the most recent .NET framework the user has, whatever that may be. I don't want to require .NET 4 to be installed, but I…
Paul Accisano
  • 1,416
  • 1
  • 14
  • 25
54
votes
10 answers

How do I find the fully qualified name of an assembly?

How do I find out the fully qualified name of my assembly such as: MyNamespace.MyAssembly, version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 I've managed to get my PublicKeyToken using the sn.exe in the SDK, but I'ld like to…
Ian G
  • 29,468
  • 21
  • 78
  • 92
53
votes
6 answers

How to check if an assembly was built using Debug or Release configuration?

I'm starting deployment of my web application and I need to guarantee that all the assemblies that are going to be deployed were built using Release configuration. Our system was developed using C#/.Net 3.5. Is there any way to achieve this?
born to hula
  • 1,274
  • 5
  • 18
  • 36
51
votes
6 answers

using ILMerge with .NET 4 libraries

Two problems: 1) Basic .NET Assembly Not Included in ILMerged Assembly I'm having trouble using ILMerge in my post-build after upgrading from .NET 3.5/Visual Studio 2008 to .NET 4/Visual Studio 2010. I have a Solution with several projects whose…
Sarah Vessels
  • 30,930
  • 33
  • 155
  • 222
50
votes
3 answers

How to keep ASP.NET assemblies in AppDomain alive?

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…
this. __curious_geek
  • 42,787
  • 22
  • 113
  • 137
50
votes
19 answers

Assembly binding redirect does not work

I'm trying to set up an assembly binding redirect, using the following app.config:
Adam
  • 605
  • 1
  • 6
  • 7
48
votes
5 answers

Best practices for signing .NET assemblies?

I have a solution consisting of five projects, each of which compile to separate assemblies. Right now I'm code-signing them, but I'm pretty sure I'm doing it wrong. What's the best practice here? Sign each with a different key; make sure the…
Domenic
  • 110,262
  • 41
  • 219
  • 271
45
votes
12 answers

Difference Between Assembly and DLL

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)?
Pushkar
  • 1,300
  • 2
  • 15
  • 20
45
votes
6 answers

.Net: Running code when assembly is loaded

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.…
Robert Wagner
  • 17,515
  • 9
  • 56
  • 72
45
votes
5 answers

Cannot add System.Web.dll reference

I'm trying to use the HTTP functions contained in the System.Web.dll assembly. However, whilst the dll seems to exist in the same directory as every other dll Visual Studio 2010 references in my project, it fails to link in and raises a warning -…
JoeR
  • 1,901
  • 3
  • 25
  • 39
44
votes
5 answers

Consider app.config remapping of assembly with no app.config mapping

How can I determine where to fix this reference without adding a binding to the app.config? Consider app.config remapping of assembly "System.Runtime.Serialization.Primitives, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "4.1.1.0"…
Mike Flynn
  • 22,342
  • 54
  • 182
  • 341
44
votes
3 answers

How to tell if a .NET assembly is dynamic?

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…
Mike Stockdale
  • 5,256
  • 3
  • 29
  • 33
43
votes
3 answers

How to get all types in a referenced assembly?

For whatever reason, I can't seem to get the list of types in a referenced assembly. Not only that, I can't even seem to be able to get to this referenced assembly. I tried AppDomain.CurrentDomain.GetAssemblies(), but it only returns assemblies…
AngryHacker
  • 59,598
  • 102
  • 325
  • 594