BizTalk Cop installation and configuration for VS 2012

I faced a requirement today that I need to enable some BizTalk best practices and create a custom check-in policy for these practices while the developers are checking in code. While searching the internet I found the BizTalk Cop (which is a great tool) that does exactly that, but unfortunately this tool supports only Visual Studio 2010 and BizTalk 2010 and does not support BizTalk 2013 and visual studio 2012. So the challenge was how to enable this to work with Visual Studio 2012. Another challenge that I had was to create a default custom check-in policy and a rules set that is enabled by default on TFS that would only allow the developers to check-in their code if they enable this rule set.

The solution that I performed involved the following changes (updates)

    1. I copied the DLL “BizTalkCop.Rules.dll” to the folder “C:Program Files (x86)Microsoft Visual Studio 11.0Team ToolsStatic Analysis ToolsFxCopRules”
    2. I created a file called “BizTalkRules.ruleset” (attached at the end of this article) containing the set of rules that are enabled by default for the projects.
    3. I copied the file “BizTalkRules.ruleset” to the folder “C:Program Files (x86)Microsoft Visual Studio 11.0Team ToolsStatic Analysis ToolsRule Sets”
    4. Changed the file “devenv.exe.config” in the folder “C:Program Files (x86)Microsoft Visual Studio 11.0Common7IDE” so that it redirects all FxCop dependencies from the 10.0 and 9.0 versions to the 11.0 version in the assembly binding section as follows:

<dependentAssembly>
  < assemblyIdentity name=”FxCopCommon” publicKeyToken=”b03f5f7f11d50a3a” culture=”neutral”/>
  < bindingRedirect oldVersion=”9.0.0.0″ newVersion=”11.0.0.0″/>
< /dependentAssembly>
< dependentAssembly>
  < assemblyIdentity name=”FxCopSdk” publicKeyToken=”b03f5f7f11d50a3a” culture=”neutral”/>
  < bindingRedirect oldVersion=”9.0.0.0″ newVersion=”11.0.0.0″/>
< /dependentAssembly>
< dependentAssembly>
  < assemblyIdentity name=”Microsoft.Cci” publicKeyToken=”b03f5f7f11d50a3a” culture=”neutral”/>
  < bindingRedirect oldVersion=”9.0.0.0″ newVersion=”11.0.0.0″/>
< /dependentAssembly>
< dependentAssembly>
  < assemblyIdentity name=”Microsoft.VisualStudio.CodeAnalysis” publicKeyToken=”b03f5f7f11d50a3a” culture=”neutral”/>
  < bindingRedirect oldVersion=”9.0.0.0″ newVersion=”11.0.0.0″/>
< /dependentAssembly>
< dependentAssembly>
  < assemblyIdentity name=”Microsoft.VisualStudio.CodeAnalysis.Common” publicKeyToken=”b03f5f7f11d50a3a” culture=”neutral”/>
  < bindingRedirect oldVersion=”9.0.0.0″ newVersion=”11.0.0.0″/>
< /dependentAssembly>
< dependentAssembly>
  < assemblyIdentity name=”Microsoft.VisualStudio.CodeAnalysis.Interop” publicKeyToken=”b03f5f7f11d50a3a” culture=”neutral”/>
  < bindingRedirect oldVersion=”9.0.0.0″ newVersion=”11.0.0.0″/>
< /dependentAssembly>

    1. Changed the file “FxCopCmd.exe.config” in the folder “C:Program Files (x86)Microsoft Visual Studio 11.0Team ToolsStatic Analysis ToolsFxCop” so that it redirects all FxCop dependencies from the 10.0 and 9.0 versions to the 11.0 version in the assembly binding section as follows:

<assemblyBinding xmlns=”urn:schemas-microsoft-com:asm.v1″>
  < dependentAssembly>
    < assemblyIdentity name=”FxCopCommon” publicKeyToken=”b03f5f7f11d50a3a” culture=”neutral”/>
    < bindingRedirect oldVersion=”9.0.0.0″ newVersion=”11.0.0.0″/>
  </dependentAssembly>
  < dependentAssembly>
    < assemblyIdentity name=”FxCopSdk” publicKeyToken=”b03f5f7f11d50a3a” culture=”neutral”/>
    < bindingRedirect oldVersion=”9.0.0.0″ newVersion=”11.0.0.0″/>
  </dependentAssembly>
  < dependentAssembly>
    < assemblyIdentity name=”Microsoft.Cci” publicKeyToken=”b03f5f7f11d50a3a” culture=”neutral”/>
    < bindingRedirect oldVersion=”9.0.0.0″ newVersion=”11.0.0.0″/>
  </dependentAssembly>
  < dependentAssembly>
    < assemblyIdentity name=”Microsoft.VisualStudio.CodeAnalysis” publicKeyToken=”b03f5f7f11d50a3a” culture=”neutral”/>
    < bindingRedirect oldVersion=”9.0.0.0″ newVersion=”11.0.0.0″/>
  </dependentAssembly>
  < dependentAssembly>
    < assemblyIdentity name=”Microsoft.VisualStudio.CodeAnalysis.Common” publicKeyToken=”b03f5f7f11d50a3a” culture=”neutral”/>
    < bindingRedirect oldVersion=”9.0.0.0″ newVersion=”11.0.0.0″/>
  </dependentAssembly>
  < dependentAssembly>
    < assemblyIdentity name=”Microsoft.VisualStudio.CodeAnalysis.Interop” publicKeyToken=”b03f5f7f11d50a3a” culture=”neutral”/>
    < bindingRedirect oldVersion=”9.0.0.0″ newVersion=”11.0.0.0″/>
  </dependentAssembly>
< /assemblyBinding>

  1. Restart VS 2012
  2. I enabled a default check-in policy using the source control settings as per the below screen shoots
    image
    image
    image
    image
  3. Make sure you perform the same steps on the TFS Build server and all developer machines.

 

 

 

Happy coding 🙂

 

http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-79-57-ContentFiles/2364.BizTalkRules.zip

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.