views:

107

answers:

1

I've got some code

var type = Type.GetType("namespace, assembly");
return Activator.CreateInstance(type);

thats works fine in most situations, however when this code is referenced in the Global.asax of a website that is debugged using Cassini/Visual Studio Development Server the type cannot be found.

The type is in an assembly that is not referenced but is normally in the same output directory as the executing assembly. However upon closer inspection it appears that during debugging Cassini put the executing assembly and each referenced assembly into its own directory in the following location C:\users...\AppData\Local\Temp\Temporary ASP.NET Files\root..... however obviously the 'unreferenced' assembly is not there.

Is there a way to have VS copy extra resources into the temp directory or alternatively to run from a specified directory? Is using IIS the only solution?

Thanks in advance.

+1  A: 

I think that this is not Cassini's doing, this is ASP.NET using .NET shadow copy to prevent locking your DLLs. So, using IIS should not change anything. The lack of explicit reference seems to let .NET put the DLLs in different directories.

Can you put this referenced DLL in the GAC ?

Timores
Yeah that makes sense. Totally forgot about that. I would really rather not use the GAC due to the number of assemblies that this unreferenced assembly references. I guess another alternative would be to disable the shadow copy (http://msdn.microsoft.com/en-us/library/system.web.configuration.hostingenvironmentsection.shadowcopybinassemblies.aspx)?Does anyone have any other possible solutions?
Martin MacPherson