I have a GAC registered assembly that I want to use in a Razor script.
I have a simple script:
@using WebServices;
@{ WebServices.OpeningTimes times = WebServices.OpeningTimes(); }
But when I save it I get this error
c:\Work\Websites\umb471\macroScripts\634527399166092274_OpeningHours.cshtml(5): error CS0433: The type 'WebServices.WebServices' exists in both 'c:\Windows\Microsoft.NET\assembly\GAC_MSIL\WebServices\v4.0_1.0.0.0__c091195f5d35fea2\WebServices.dll' and 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\2521ee78\f123e9ea\App_Code.blrv9t7r.dll'
Has anyone done anything similar, got any ideas etc? many thanks if you can help, it's driving me insane ;-) Jay
A possible workaround: You could add an explicit reference to the GAC version of the WebServices.dll inin your web config. Otherwise, it might help deleting the temporary files (however likely your app is copying that file on every start).
GAC registered components and Razor
Hi,
I have a GAC registered assembly that I want to use in a Razor script.
I have a simple script:
@using WebServices;
@{
WebServices.OpeningTimes times = WebServices.OpeningTimes();
}
But when I save it I get this error
c:\Work\Websites\umb471\macroScripts\634527399166092274_OpeningHours.cshtml(5): error CS0433: The type 'WebServices.WebServices' exists in both 'c:\Windows\Microsoft.NET\assembly\GAC_MSIL\WebServices\v4.0_1.0.0.0__c091195f5d35fea2\WebServices.dll' and 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\2521ee78\f123e9ea\App_Code.blrv9t7r.dll'
Has anyone done anything similar, got any ideas etc?
many thanks if you can help, it's driving me insane ;-)
Jay
Hi Jay,
Ouch, those errors hurts. Some ideas:
A possible workaround: You could add an explicit reference to the GAC version of the WebServices.dll inin your web config. Otherwise, it might help deleting the temporary files (however likely your app is copying that file on every start).
Hope you find a solution
Also : is this a new 4.7.1 installation?
Jonas
Hey Jonas,
:-) They do indeed.
Thanks for the input.
I already have an explicit reference to the GAC version of the WebServices.dll in web config.
I deleted the files but as you suspect it copies them over each time it is instantiated.
Yes, it's 4.7.1 alpha. Maybe I'll try it in 4.7 stable.
Thanks
Jay
just a small update, I have created a vanilla mvc3 web app and referenced my GAC assembly and can access it successfully.
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.