DevLabs > DevLabs Forums > Code Contracts > CodeContracts XML docs not getting generated
Ask a questionAsk a question
 

StickyCodeContracts XML docs not getting generated

  • Thursday, November 05, 2009 9:55 PMManuel FahndrichMSFT, OwnerUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    There were reports that the XML contract generation was not working and indeed it ins't in the latest release due to a refactoring bug in the build scripts.

    If you want to fix it yourself, here's what to change:

    You need to edit both of the following files (need Admin privilege)

                    %Program Files%\Microsoft\Contracts\MsBuild\v3.5\Microsoft.CodeContracts.targets

                    %Program Files%\Microsoft\Contracts\MsBuild\v4.0\Microsoft.CodeContracts.targets

     

     Find the section below and make the Condition match the highlighted text.

      <!--=====================================================================

            Add post build step for contract XML documentation generation

        ======================================================================-->

      <PropertyGroup

          Condition="'$(CodeContractsEmitXMLDocs)' == 'true'">

        <PrepareForRunDependsOn>$(PrepareForRunDependsOn);ContractXmlDocumentation</PrepareForRunDependsOn>

      </PropertyGroup>

     

    The erroneous version looks like this:

     

      <!--=====================================================================

            Add post build step for contract XML documentation generation

        ======================================================================-->

      <PropertyGroup

          Condition="'$(CodeContractsEmitXMLDocs)' == 'true' and '$(CodeContractsBuildReferenceAssembly)' == 'true'">

        <PrepareForRunDependsOn>$(PrepareForRunDependsOn);ContractXmlDocumentation</PrepareForRunDependsOn>

      </PropertyGroup>

     


    Cheers, -MaF (Manuel Fahndrich)

Answers

  • Friday, November 13, 2009 4:25 PMMike BarnettMSFT, OwnerUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    It appears this has been fixed in our internal builds, so it should (famous last words...) work in the next release. We'll try to get one out soon. Sorry for the problem!

All Replies

  • Friday, November 06, 2009 3:11 PMJan Sebetovsky Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I tried to fix it and now ccdocgen is runned by Visual Studio, but it generates nothing into XML file.
    I checked both needed checkboxes in project properties.
    When I tried to run ccdocgen from command line, it changed the XML file (date of modification changed), but it doesn't contain nothing from Code Contracts.
    This is first time I am trying to generate documentation, so there is possibility that I did some stupid mistake.

    Can someone help me?

    Jan Šebetovský

  • Friday, November 13, 2009 4:25 PMMike BarnettMSFT, OwnerUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    It appears this has been fixed in our internal builds, so it should (famous last words...) work in the next release. We'll try to get one out soon. Sorry for the problem!