Last post Jan 16, 2009 03:31 PM by Ben Randolph
Jan 15, 2009 11:05 AM|thanhhuynh|LINK
I have a web app project that references a class (Core) in assembly "XYZ.dll" that's built in the same solution. By default, VS.NET copies A.dll into the bin folder. But my architecture requires XYZ.dll to be located in a folder named "plugins" so that
the application can dynamically load other classes in this assembly. So here is what I did:
- Tell VS.NET not to copy XYZ.dll locally.
- In the post build event, copy A.dll into "plugins"
- Add this section to web.config
<probing privatePath="bin;plugins" />
Now, my folder looks like this:
XYZ Library Project
Everything works properly in IIS. However when I run it in ASP.NET Web Development Server, I get the following error when I open the page ("Core" is a class that's defined in XYZ.dll)
Here are my questions
1) why does ASP.NET Dev Server say it's compiling the page - again ? Is there a way to tell it to run without recompiling?
2) Why does it seem to ignore <probing privatePath>?
3) How should I get around this problem and make it works on ASP.NET Web Dev? (I can't have both XYZ.dll in bin and plugins, I have a logic that compares the loaded classes based on the type)
Jan 16, 2009 03:31 PM|Ben Randolph|LINK
I think that <probing privatePath> only works in asp.net applications, not in asp.net websites in Visual Studio (Web Dev in your case).
If you want to reference an assembly that's not in the webiste's bin directory in the page, use the @Assembly directive:
If you want to reference an assembly that's not in the bin directory from your C# code, you can reflect the assembly via Assembly.Load and you can use reflection to access all the assembly's classes.
You'd actually use Assembly.LoadFrom(assemblyPath) to load an assembly from a physical path on your server.