views:

73

answers:

2

Hi All!

How can I determine the actual filename (App_Code_xxx.dll) of the types (classes) which is being built by my build provider.

For instance I have a build provider which injects classes based on some configuration. Say MyNameSpace.MyClass. When this build provider is consumed by the Web App. I just want to know the actual file(.dll) which was compiled on the disk by asp_net.dll in temporary files.

In true sense I even want to control the naming for this file.

Thanks in Advance.

Mohammed

A: 

Assuming that YourClass is defined in YourDll.dll, then you can use the following code:

  var assembly= Assembly.GetAssembly(typeof(YourClass);
  string dllName=assembly.GetName().Name;  
  Assert.AreEqual("YourDll", dllName);
Ngu Soon Hui
+1  A: 

I never liked the website build approach that came with Visual Studio 2005 that created a new file named App_Code_xxx.dll every time you build, it's just pain to work with it.

Visual Studio 2005 SP1 (and later versions) have a web application which builds your project into a single .dll (like was done in .net 1.1) and is much easier to work with, I would recommend comverting your website to web application. Tutorials are available here and here

This way you don't have to worry about the filename that was written on disk

armannvg