user3498178
user3498178

Reputation: 101

Add assembly reference to a deployed ASP.NET site

I'm trying to find out how Assembly References actually manifest in the deployed file structure of an ASP.NET website running on IIS.

This is an exercise in understanding what Visual Studio is actually doing behind the scenes

The assembly that I've picked as a test subject is System.IO.Compression.FileSystem, as this seems not to be referenced by default in an ASP.NET project (attempts to use it's components always result in "Are you missing an assembly reference?" even if the using statement for the corresponding namespace System.IO.Compression is in the file)

So I have some small sample code that tries to use this assembly sitting on an IIS server and I want to add the reference in-situ to the deployment without opening Visual Studio

I think I'm very close to the answer with IISManager->[[SITE_NAME]]->.NET Compilation->General->Assemblies, but nothing that I add to this list seems to work, I always get back "System cannot find the file specified" also if I've understood the documentation correctly the entry "*" should load everything, but doesn't seem to be doing that

Upvotes: 5

Views: 3694

Answers (2)

user3498178
user3498178

Reputation: 101

I got to the answer myself in the end, details follow for the benefit of future readers

IISManager->[[SITE_NAME]]->.NET Compilation->General->Assemblies is indeed the correct place to do this, it wasn't working because I had mistyped the PublicKeyToken

The list of assemblies can also be found in the main web.config file for your site in configuration->system.web->compilation->assemblies

you need to find the assembly you want to reference in the GAC at Windows/Microsoft.NET/assembly and open it's folder, inside will be another folder named with the version and key that you need to put in

Upvotes: 5

Rob
Rob

Reputation: 45761

When you refer to References and using statements, you're conflating two different things.

References are assemblies that are pointed to by your assembly. If you use a de-compiler (like Telerik JustDecompile), you can see the assemblies that you set as references in Visual Studio listed.

'using' statements are a code shortcut that allow you to reference classes without fully qualifying them. If you've added (in an MVC project, for example) using System.Web.Mvc; you can write:

public ActionResult Index()
{
    throw new NotImplementedException();
}

Without the using statement, you'd have to write:

public System.Web.Mvc.ActionResult Index()
{
    throw new NotImplementedException();
}

Both of the above will result in the same compiled byte-code; the using statement is purely there to make your life easier as a developer.

Upvotes: 0

Related Questions