locked
The type or namespace name 'PSutils' could not be found (are you missing a using directive or an assembly reference?) RRS feed

  • Question

  • User-1198794522 posted

    I created a new Default Web Site Application. I have others web sites working fine. But on this new one it is not recognizing my main program dll that is setup in Gacutil. If i install PSutils.dll in the bin folder of this site (PSWS) then it works fine. But when i remove it from the bin directory (so that it uses the PSutils.dll installed in the Gac) then it fails with this error?? I'm confused and do not know what to do to fix this? Thanks!

    Server Error in '/PSWS' Application.

    Compilation Error

    Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

    Compiler Error Message: CS0246: The type or namespace name 'PSutils' could not be found (are you missing a using directive or an assembly reference?)

    Source Error:

    Line 19:         </ul>
    Line 20:         <br />
    Line 21:         <% var psutil = new PSutils.PSutil();
    Line 22:            var ver = psutil.psutilsVersion; %>
    Line 23:         <p>


    Source File: c:\inetpub\wwwroot\PSWS\Views\Home\Index.aspx    Line: 21

    Sunday, June 24, 2012 7:01 AM

Answers

  • User1932589091 posted
    Hello,

    Have you add the assembly from your web.config like below?

    <add assembly="PSutils" />

    If not, please add it
    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Sunday, June 24, 2012 2:11 PM

All replies

  • User-1731511703 posted

    There are a lot of suggestions at these links on how to get this to work:

    http://stackoverflow.com/questions/444655/how-can-i-reference-a-dll-in-the-gac-from-visual-studio

    http://stackoverflow.com/questions/5028368/how-to-reference-assembly-from-gac

    The second link has good general information on the GAC and how it works at runtime versus development.

    Sunday, June 24, 2012 7:19 AM
  • User-1198794522 posted

    At run time, components must be either in the output path of the project or in the Global Assembly Cache (GAC).

     In development in Visual Studio 2010, the reference is to another VS project that contains the DLL, it is set to Copy Local, and in development it works fine.

    When i deploy, I do not deploy PSutils.dll for runtime, on my IIS Windows Server, PSutils.dll is already installed in the GAC and it is working fine for 10 other web sites installed on the same server. In this new web site, it is not finding PSutils.dll in the GAC (but it does work if I copy it to the \bin folder like I said above).

    The links you gave me state what i already know and they are not helpful. Maybe there is someone else that knows more about this? There has to be some simple reason for this failure?

    Thanks

    Sunday, June 24, 2012 9:21 AM
  • User1932589091 posted
    Hello,

    Have you add the assembly from your web.config like below?

    <add assembly="PSutils" />

    If not, please add it
    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Sunday, June 24, 2012 2:11 PM
  • User-1198794522 posted

    You are the man!

            <add assembly="PSutils, Version=1.0.0.1, Culture=neutral, PublicKeyToken=obscuredxxxx"/>

    Wondering why Visual Studio does not add this by default? Maybe because of the PublicKeyToken that is required??

     Anyway, working good now. Thank you.

    Monday, June 25, 2012 6:59 AM