Reputation: 267010
Normally when you add a new assembly you have to go into Visual Studio and add a reference (the .dll is stored in the /bin directory).
Since this website compiles on the fly, is it possible for me to just add the .dll to the live website, and then use that .dll in an .aspx page?
Currently in Visual Studio I can't see the .dll unless I go to 'add reference'.
Upvotes: 9
Views: 6041
Reputation: 144122
You can indeed reference an assembly without going through Visual Studio. Steps:
<%@ Assembly Src="pathToDll" %>
or <%@ Assembly Name="assemblyName" %>
to the top of your ASPX page.<%@ Import Namespace="Foo.Bar" %>
at the top of the page.Then reference away!
Adding the reference in Visual Studio is only for compile-time support. Any static references to types in your non-ASPX code (e.g. codebehinds) must be resolved by the compiler, so all DLLs obviously need to be present. Since ASPXs are usually compiled on the server at request time, as long as the referenced DLLs are available then, everything will come together.
Upvotes: 11
Reputation: 421988
Yes, it's perfectly possible to change the DLL on the live Web site. Just swapping the DLL in the /bin
directory will make the application bind to the new one. However, Visual Studio needs the DLL to exist at development time to provide IntelliSense and validate the Web site.
Upvotes: 3