locked
Ways to resolve CA0060 warning RRS feed

  • Question

  • HI all,

    We have turned on the CodeAnalysis rules and we see the following warning

    CA0060 : The indirectly-referenced assembly 'Microsoft.VisualStudio.QualityTools.Sqm, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' could not be found. This assembly is not required for analysis, however, analysis results could be incomplete. This assembly was referenced by: C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.TestTools.UITest.Extension.dll.  

    Inorder to resolve the above warning we have added "'Microsoft.VisualStudio.QualityTools.Sqm" reference to our project but what we found is that the hint path has hardcoded path to the dll(path includes local VS private assemblies folder path). Hint path may vary from machine to machine depending upon the VS installation path.

    I have also tried one more workaround like copying the dll's to the output folder of the project and the warning got resolved but while running we see some random exceptions.

    I have also tried the workaround suggested in one of the MSDN fourm like modifying the FxcopCmd.config file to have StrongNameIgnoringVersion set. Even this workaround also did not work.

    Can any one suggest any better solution apart from the above?

    Thanks n Regards,

    Sirisha.

     

     

     


    sirisha
    Friday, December 2, 2011 4:57 AM

Answers

  • You can use the $(DevEnvDir) property to reference the Visual Studio path. Irrespective of where Visual Studio is installed. This will point to the Common7\IDE folder by default, so you might need to use ..\..\ to reference paths above it. Or you can use $(VSINSTALLDIR) or $(VS100COMNTOOLS).

    Note: You must set the an environment variable on the build server's system environment settings for this variable to work outside of Visual Studio and on the Build Server. See: http://connect.microsoft.com/VisualStudio/feedback/details/368734/-devenvdir


    My blog: blog.jessehouwing.nl
    • Edited by Jesse HouwingMVP Monday, December 5, 2011 11:06 AM
    • Marked as answer by Sirisha M Thursday, December 8, 2011 10:21 AM
    Monday, December 5, 2011 11:04 AM

All replies

  • You have 3 options:

    - use the /d command line option to point fxcopcmd to the location where it can find the referenced assemblies (you can add multiple /d options) http://msdn.microsoft.com/en-us/library/bb429449(v=vs.80).aspx

    - Put the assembly in the folder containing your other project assemblies

    - Put the assembly in the GAC


    My blog: blog.jessehouwing.nl
    Friday, December 2, 2011 11:41 AM
  • If you get strange behavior after that, please post the messages you're seeing, then we can help you solve those.
    My blog: blog.jessehouwing.nl
    Friday, December 2, 2011 12:06 PM
  • Houwing,

    Thanks for the response.

    Can you please porvide an example as of where and how to specify the cmd line options in the solution file?

    Your help is greatly appreciated.

    Thanks n Regards,

    Sirisha.

     


    sirisha
    Friday, December 2, 2011 12:22 PM
  • You can edit the project file and add the search locations to the <PropertyGroup> tag:

    <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
      ...
    <CodeAnalysisAdditionalOptions>/d:[[yourpathhere]]</CodeAnalysisAdditionalOptions>
    Or you can add a reference to the assembly and set it to copy local.


    My blog: blog.jessehouwing.nl
    Friday, December 2, 2011 12:50 PM
  • Hi Houwing,

    I see the code analysis warning for one of the VisualStudio private assembly that dll is present under C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies folder. PrivateAssemblies folder varies from machine to machine, if I reference the dll in the project, the hint path will be hardcoded in csproj. Moreover I don't want to set copy local to true because this is resulting in unknown exceptions.

    Regarding the solution <CodeAnalysisAdditionalOptions>/d:[[yourpathhere]]</CodeAnalysisAdditionalOptions> , can you please tell me how can I mention the PrivateAssemblies path that works for all the people irrespective of the VS installation location?

    Thanks,

    Sirisha


    sirisha
    Monday, December 5, 2011 5:02 AM
  • You can use the $(DevEnvDir) property to reference the Visual Studio path. Irrespective of where Visual Studio is installed. This will point to the Common7\IDE folder by default, so you might need to use ..\..\ to reference paths above it. Or you can use $(VSINSTALLDIR) or $(VS100COMNTOOLS).

    Note: You must set the an environment variable on the build server's system environment settings for this variable to work outside of Visual Studio and on the Build Server. See: http://connect.microsoft.com/VisualStudio/feedback/details/368734/-devenvdir


    My blog: blog.jessehouwing.nl
    • Edited by Jesse HouwingMVP Monday, December 5, 2011 11:06 AM
    • Marked as answer by Sirisha M Thursday, December 8, 2011 10:21 AM
    Monday, December 5, 2011 11:04 AM
  • Houwing,

    Thanks for the response.

    The above solution worked perfectly, thanks again.

    Thanks n Regards,

    Sirisha.

     


    sirisha
    Thursday, December 8, 2011 10:24 AM