Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top