CA0055, Silverlight5, Business Application project - by Mike Dos Zhang

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 713608 Comments
Status Closed Workarounds
Type Bug Repros 35
Opened 12/12/2011 11:03:24 PM
Access Restriction Public


After use the Silverlight5 in Visual Studio to create a new Business Application project, and config the Code Analysis page to let it run when build the project.
Then the result is the CA0055 error, we cannot suppress it.
When use the Reflector Tool to view the Business Application library, it real references two different version mscorlib and other assemblies.
Sign in to post a comment.
Posted by edwiles on 1/14/2013 at 8:38 AM
Instead of running FxCop from the command line, we added the following two lines to the <PropertyGroup> section of our project files:

    <CodeAnalysisAdditionalOptions>/directory:"$(ProgramFiles)\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0" /directory:"$(ProgramFiles)\Microsoft SDKs\Silverlight\v4.0\Libraries\Client" /directory:"$(ProgramFiles)\Microsoft SDKs\Silverlight\v5.0\Libraries\Client" /directory:"$(ProgramFiles)\Microsoft SDKs\RIA Services\v1.0\Libraries\Silverlight"</CodeAnalysisAdditionalOptions>
    <CodeAnalysisPlatformPath>$(ProgramFiles)\Reference Assemblies\Microsoft\Framework\Silverlight\v5.0\mscorlib.dll</CodeAnalysisPlatformPath>

Code Analysis now runs within Visual Studio for us. This is similar to one of the comments in the Workarounds tab, except we didn't need to change any shared files.
Posted by Vincent Thavonekham (RD, MVP, P-Seller Azure)007 on 6/7/2012 at 2:58 AM
We are also facing the same issue. I don't see our team running every single time FxCop as a command line (even in the "Build event"), as we have already too many quality tools and rules. Moveover, this would mean changing manually 300 csproj, and test for non regression...

Therefore, we stick so far to SL4, but it presents some other major side effects, such as new components on SL4 does no behave the same way in SL4.
We might just end-up disabling all CA and use third-party tool.
Posted by Bill [FIS] on 4/19/2012 at 11:56 AM
The workaround to use the FxCop command line isn't enough. We have too many build definitions & projects using the integrated code analysis to manually go change the all the build processes. Please reconsider issuing a fix for VS2010.
Posted by Mek7 on 4/18/2012 at 11:20 PM
Closed as fixed? You must be kidding.
This issue is a major showstopper for our upgrade to Silverlight 5 because we are using RIA services client DLLs which are available targeting SL4 only. There is no way we could get them targeted to SL5 and that's why we are getting references to two versions of mscorlib and other DLLs.
We are using the GUI version of FxCop (10.0) and that one does not accept any of the parameters described in earlier posts. And there is no way to set it in the GUI or manually in project file.
Posted by Microsoft on 4/4/2012 at 12:18 PM
@DuffC, this bug is specifically referring to an issue with FxCop which is completely unrelated to the Service Reference proxy generation tool. If you are having issues with that tool, please file a new connect bug for that.

Visual Studio Code Analysis Team
Posted by Microsoft on 4/4/2012 at 12:16 PM

We understand that this bug is causing significant difficulties for developers, and after some research there is a way to work around the error by running FxCop from the command line. While not ideal, this will unblock using FxCop in Visual Studio 2010 on Silverlight 5 Business Applications.

A high level walkthrough of how this works from the command line is:
•    We will tell FxCop which version of the runtime it will be using by pointing it to Silverlight 5’s installed mscorlib.dll using the /platform argument
•    Tell FxCop where to find all of the referenced assemblies using /d (short for /directory) arguments: Use as many /d:<folder> arguments as necessary for FxCop to find all of the referenced assemblies.
•    Use either /console to tell FxCop to output the results to the console window, or /out:<file> to tell FxCop to write the results to an .xml file

To run FxCop from the command line for a default Business Application:
•    Add the %Visual Studio Install Directory%\Team Tools\Static Analysis\FxCop folder to PATH
•    Run “fxcopcmd.exe /file:<SL Business Application binary> /platform:<SL5 Reference Assemblies Directory\mscorlib.dll> /d:<SL4 Reference Assemblies Directory> /d:<SL4 SDK Client Libraries Directory>”

An example of what this looks like on an x64 operating system with all of the default install directories is:
•    SET PATH=%PATH%;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop
•    fxcopcmd /file:BusinessApplication1.dll /platform:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v5.0\mscorlib.dll" /d:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0" /d:"C:\Program Files (x86)\Microsoft SDKs\Silverlight\v4.0\Libraries\Client" /out:results.xml
•    NOTE: If you receive a CA0001 error: “The following error was encountered while reading module ‘XXXX.YYYYY’ : Assembly reference cannot be resolved…” this means that you need to find where that assembly is installed to on your machine and add an additional /d:<installed directory> argument pointing FxCop to where those assemblies are installed.

Best Regards,
Visual Studio Code Analysis Team
Posted by DuffC on 4/1/2012 at 10:43 PM
I believe the impact of this goes further than code analysis. It's also stopping me using the Service Reference proxy generation tool built into VS2010. I have a DLL that I need to reuse types from, but that DLL references another DLL that references System.Xml version When I try to update my service reference it fails with the following errors:

"Custom tool error: Failed to generate code for the service reference 'Service'. Please check other error and warning messages for details."

"Custom tool warning: Could not load file or assembly 'System.Xml, Version=, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' or one of its dependencies. The system cannot find the file specified."

We need a pre-VS11 workaround for this as it's a huge issue for those of us trying to develop Silverlight 5 apps with VS2010.
Posted by Gael.Fraiteur on 3/29/2012 at 11:24 PM
As one of the many ISVs who ship Silverlight libraries (PostSharp in our case), I would like to urge you to reconsider your decision to postpone the solution of this issue to Visual Studio 11.

As a result of your decision, customers are turning to ISVs to deliver a new version of products linked to Silverlight 5, even if there is no other technical reason than working around the current issue. I think this is not fair from the Visual Studio team to claim insufficient resources and push the responsibility to other vendors, who have even smaller resources, to implement workarounds.

As the dominant vendor, you have a greater responsibility and, in my opinion, you should assume it.

Thank you for your understanding.
Posted by Microsoft on 3/16/2012 at 5:36 PM

Thank you for taking the time to report this. This issue was caused by a versioning decision made by the Silverlight team for the Silverlight 5 runtime. Unfortunately since Silverlight 5 was shipped after the Visual Studio 2010 service pack, we do not have the resources to release an additional fix to Visual Studio 2010 to address this issue at this time. This issue will however be fixed in the RC version of Visual Studio 11.

We apologize for any inconvenience this may cause.

Best Regards,
Visual Studio Code Analysis Team
Posted by Aravind Khasibhatla on 2/9/2012 at 8:36 AM
Dear Moderators, Could someone please shed some light on to what's the status on this issue? We had also been waiting for the last few months like everyone. Thanks a lot in advance!

Posted by Carel.Lotz on 2/2/2012 at 6:25 AM
As mentioned by the other folks, this is stopping us from upgrading to SL 5. It's applicable to all SL 5 projects, not only Business Application Projects. Please get a fix out for this.
Posted by SBrennan47 on 1/10/2012 at 11:08 AM
Is this being looked into? Has anyone found a workaround for this yet?
Posted by Alex Maklakov on 1/4/2012 at 7:14 AM
Met with the same problem after conversion from SL4 to SL5.
(as one of 3rd-party components we are used created for previous version of silverlight)

Also tried to avoid it by adding <CodeAnalysisPlatformPath>C:\Program Files (x86)\Microsoft Silverlight\5.0.61118.0\</CodeAnalysisPlatformPath> into project file, but it doesn't help.

Posted by Vincent Quinten on 1/3/2012 at 1:27 AM
Like Adil Zaheer and Aquariusquintini, this is also a big blocker for us to adopt Silverlight 5.
Posted by Adil Zaheer on 12/29/2011 at 6:57 AM
Has their been any progression with this issue yet? Like Aquariusquintini it is a big blocker for us to. Stopping us from fully converting to Silverlight 5.
Posted by Aquariusquintini on 12/28/2011 at 8:42 AM
This issue is not only applicable to the Business Application project. We also experienced the same error when converting our existing Silverlight 4 applications to Silverlight 4.
Two kinds of errors were popping up:

Error    1    CA0052 : No targets were selected.

Error    2    CA0055 : Could not unify the platforms (mscorlib, Version=, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, mscorlib, Version=, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) for 'MyProject.Silverlight\obj\Debug\MyProject.dll'.

Hopefully a solution to this problem is found quickly, since it is a big blocker for us right now.        
Posted by MS-Moderator08 [Feedback Moderator] on 12/14/2011 at 1:14 AM
Thank you for reporting the issue.
We are routing this issue to the appropriate group within the Visual Studio Product Team for triage and resolution.These specialized experts will follow-up with your issue.
Posted by MS-Moderator01 on 12/12/2011 at 11:42 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(