locked
"Could not import all messages." error supression

    Question

  • I am using FxCop in a build server. I have an FxCop project files, saved under source safe with my project dlls.

    In the same folder (MyDll/FxCop), I have the dictionary for my  each dll.

    So I have:

    MyDll (folder)

      Source1.cs

      Source2.cs

      FxCop(folder)

        MyDll.Fxcop

        CustomDictionary.XML

    All these files are in source safe.

    The pupose of the FxCop project (for my use) is to save any exceptions, load the correct Dll to anayze and to cause the dictionary for that project to be loaded, using the rule "dictionary can be in same location as project file".

    At the time the FxCop file is created and checked in, there may be some open FxCop issues.

    As time goes by, developers fix these issues, or different issues are reported.

    This causes the build server to raise warning from FxCop "Could not import all messages.".

    I have no interest in "previous messages" just the current anaysis.

    Is there any way to tell FxCop to "ignore all previous messages", so that my build no longer reports warnings?

    Currently I have to check out the FxCop file, run FxCop manually and check it in again, to clear the build warnings. Obviously this is not productive.

    I am using version 1.35 beta 1 with .Net 2.0.

    Thanks

    Trevor

    Tuesday, March 28, 2006 8:47 PM

Answers

  • Trevor,

    If you have no interest in previous messages, than I think the easiest way to do this would be to prevent FxCop from saving the messages to the project.

    To do this:

    1. Open your project in FxCop
    2. Choose Project -> Project Options
    3. Under Save Messages and next to Project uncheck the Active checkbox
    4. Click OK

     

    Tuesday, March 28, 2006 9:26 PM
    Moderator

All replies

  • Trevor,

    If you have no interest in previous messages, than I think the easiest way to do this would be to prevent FxCop from saving the messages to the project.

    To do this:

    1. Open your project in FxCop
    2. Choose Project -> Project Options
    3. Under Save Messages and next to Project uncheck the Active checkbox
    4. Click OK

     

    Tuesday, March 28, 2006 9:26 PM
    Moderator
  • Hi, David!

    I'm having this issue with FxCop 1.36.
    Is there another solution which keeps previous messages ?

    Thanks
    WBR, Vitaliy
    Friday, June 5, 2009 7:39 AM
  • Is there some reason you want to keep previously active messages rather than simply considering those that are currently active at any given build?  Also, do you require developers to run FxCop before check-in?
    Friday, June 5, 2009 12:12 PM
  • Hi,

    I have done settings suggested by David.

    But still facing the issue. Any suggestion or idea? I am using version 1.36

    Thanks,

     

     

    Tuesday, May 11, 2010 9:15 AM
  • Do you have any violation suppressions saved in your .fxcop file?

    Tuesday, May 11, 2010 11:38 AM
  • if you mean excluded messages, yes i have few messages excluded. Those are related to framework related code.

    But typical observation when i get "could not import all messages" is:

    Let's say i have some properties exposed in some class. And there is some FxCop error in that code.

    If I moved that code to some other place or deleted for that matter and open FxCop project again, it shows me this error

     

     

    Tuesday, May 11, 2010 1:09 PM
  • If you don't have in-project exclusions for the moved property, you presumably haven't correctly configured your project to exclude active messages.  If you do have an in-project exclusion for the moved property, you will need to re-create the exclusion against the new version of the property after re-running FxCop.
    Wednesday, May 12, 2010 7:21 PM
  • As far as I can tell, I'm having the same issue but the above solution isn't working in my case - hopefully its just a configuration issue.

    I have FXCop 1.36 with Save Messages: Project - Active (Unchecked) Excluded (Checked), Report - Active (Checked as All Active).

    When an error previously saved as 'Excluded' is actually fixed, the build fails saying "Could not import all messages".  The solution is to open FXCop, Analyze, and save.  Nothing shows up on the analyze so I'm assuming it just took that extra step to clean out the old exclusions.

    Is ther any way fxcop could just get rid of no-longer-existing exclusions quietly without forcing me to hit 'Analyze' to do it?

    Friday, January 14, 2011 4:29 PM
  • Nope.  If you want to save the exclusions in your project file, then you need to perform an analysis run to remove them from the project file.

    That said, if these are permanent exclusions, you may want to consider using in-code suppressions (via SuppressMessageAttribute) instead of saving the exclusions to your .fxcop file.

    Friday, January 14, 2011 6:12 PM