Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • jaygreasley 416 posts 403 karma points
    Sep 27, 2011 @ 18:09
    jaygreasley
    0

    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

  • Jonas Eriksson 930 posts 1825 karma points
    Sep 27, 2011 @ 19:26
    Jonas Eriksson
    0

    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

  • jaygreasley 416 posts 403 karma points
    Sep 27, 2011 @ 19:40
    jaygreasley
    0

    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

  • jaygreasley 416 posts 403 karma points
    Sep 28, 2011 @ 09:39
    jaygreasley
    0

    just a small update, I have created a vanilla mvc3 web app and referenced my GAC assembly and can access it successfully.

Please Sign in or register to post replies

Write your reply to:

Draft