views:

196

answers:

1

I've created an interop for a COM dll via tlbimp and added it to the assembly cache. To use this in an ASP.net page i need to include the following

<%@ Page Language="VB" Debug="true" CompilerOptions='/R:"C:\Program Files\blah\blah\LIBRARY.dll"'%>
<%@ Import Namespace=LIBRARY %>

Why do i need the CompilerOptions directive if it's in the assembly cache? Can i simplify and centralize this?

+1  A: 

You should just be able to add a reference just as you would add any other assembly reference. That's all /R: does.

EDIT: If you're not explicitly building the web app elsewhere, using /R in the aspx file is probably your best bet. The reason you need it is that ASP.NET is effectively building the application for you, and something needs to tell it which library to reference, even if that library is in the GAC. It's just like normal assembly references in a Visual Studio project - if you remove a reference to System.Xml, you won't be able to use the XML classes even though that assembly's in the GAC.

Jon Skeet
Thanks Jon, i'm not using Visual Studio. How can i do this in VB or C# code only? I've tried "Import LIBRARY" and LIBRARY is in the assembly cache and it doesn't work. Any ideas?
Mark Nold
Thanks for the additional clarification Jon.
Mark Nold