Using SHFB in a TFS Build

Topics: User Forum
Feb 11, 2009 at 2:37 PM
Edited Feb 11, 2009 at 2:40 PM
When using SHFB in a TFS build and have the documentation source set to a project file, the 'Platform' property is normally set to 'Any CPU' (notice the space), but the project files expect 'AnyCPU'. I am not sure where the translation takes place so that TFS builds work correctly, but SHFB will not be able to find the assembly and will generate an error.

To make SHFB work correctly in a TFS build, you need to override the default platform and specify the platform as 'AnyCPU' similar to the following:

<SolutionToBuild Include="$(SolutionRoot)\Doc\Help.shfbproj">
    <Targets>Build</Targets>
    <Properties>Platform=AnyCPU</Properties>
</SolutionToBuild>
 
Coordinator
Feb 11, 2009 at 4:17 PM
The Team Build topic in the help file suggests a different way of building the help file project.  Since I don't have access to Team Build I have to rely on those that do to supply info about how to use it.  Can you take a look at the topic and perhaps suggest an alternate or better way to build the help projects?  The method suggested in the current help topic will work but has a couple of problems right now.  One is that it causes a BHT0001 warning which I've got fixed for the next release.  The other is that it doesn't appear to always pick up the XML comments files.  There's a workaround for that too but it makes an assumption about the XML comments filename and its location in the $(OutDir) folder.  If your way doesn't suffer from those problems, it would be a better solution.  Thanks.

Regarding "AnyCPU" versus "Any CPU", the project files always seem to use "AnyCPU" (no space) so I'm not sure if MSBuild is just removing spaces from the value or if they are just considered equivalant somewhere.  I can probably modify SHFB to do something similar by removing spaces for that value if it isn't found though I'm not sure if I should do it for all values.

Eric
Feb 11, 2009 at 7:21 PM
I am using TFS 2008. I know of two ways to generate documentation in a TFS build. One is to override the GenerateDocumentation target as you have described in the SHFB help topic. The other way is to include it in the list of solutions to be built (the SolutionToBuild item list). Since SHFB now uses msbuild project files, it can be included in the list directly and built along with the other source projects. This is the method I am using. I also set the "<CustomizableOutDir>true</CustomizableOutDir>" property so that I don't have the problem of the output directory being modified during a TFS build. We do this because we create our install as part of the build and don't want all the generated files copied to the common output directory.

I will have to setup a test project to see where the XML comments file is placed if I leave the 'CustomizableOutDir' property at its default value of false. The name of the comments file shouldn't change since it is specified in the "DocumentationFile" property of the project file.

I looked through the target files and cannot see any place that the "Any CPU" is being translated to "AnyCPU". So maybe MSBuild is doing it internally for project types that it knows about. Since it is passed in as a parameter on the command line to the SHFB project, you cannot override it inside the SHFB project file. It would have to be handled in your build task.