Referencing assembly from GAC using @assembly fails

  • Thread starter Thread starter Brent
  • Start date Start date
B

Brent

I have strong named an assembly and installed it into the GAC. I have
copied the same assembly to a local folder and made reference to it
and set 'Copy Local' to false in the VS IDE, so that my code compiles.

Then I put the @assembly directive in the html code like this:
<%@ Assembly Name="MPCommon"%>

When I try to run the page, I get a parser error saying:

"File or assembly name MPCommon, or one of its dependencies, was not
found."

Why is this occurring and how can this be fixed?
 
I finally figured this out.

I took the '@ assembly' reference out from the .aspx page and put it
into the web.config page. However, it threw an error and so I put it
into machine.config and it worked. However, when I would change the
assembly it didn't download the right one to the calling application.
Later, I found out that the aspnet_wp.exe (worker process) would have
to be killed and then reloaded to serve up the right one from the GAC.
On a production server I simply cannot afford to do this as session
state would be lost and I'd get fired. So, I tinkered again with
web.config and discovered that I didn't place the '<add assembly...'
reference in the right spot on the page, under '<compilation...>'. Now
it works fine and downloads changes.
 
Back
Top