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.0\Team Tools\Static Analysis Tools\FxCop\Rules”

  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.0\Team Tools\Static Analysis Tools\Rule Sets”

  4. Changed the file “devenv.exe.config” in the folder “C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE” 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>

  5. Changed the file “FxCopCmd.exe.config” in the folder “C:\Program Files (x86)\Microsoft Visual Studio 11.0\Team Tools\Static Analysis Tools\FxCop” 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>

  6. Restart VS 2012

  7. I enabled a default check-in policy using the source control settings as per the below screen shoots
    image
    image
    image
    image

  8. Make sure you perform the same steps on the TFS Build server and all developer machines.

Happy coding :)