Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
You can create your own custom pre-generation build logic by utilizing the CodeSmith Generator Task within MSBuild. MSBuild tasks help manage the build process within your Visual Studio projects.

Why would I want to roll my own when you integrate it with Visual Studio?

...

Debug: a boolean property that indicates if the templates should be compiled in debug mode.

Property: a string property that takes a list of key value pairs that should override any property values defined in the CodeSmith Generator Projects.

You can also specify your own templates to run during this custom build process by using the CspFiles tag. This will let you specify your items in an ItemGroup and pass them all into ProjectFiles.

...

Code Block
languagehtml/xml
<ItemGroup>
      <CspFiles Include="MyProject.csp" />
      <CspFiles Include="MyOtherProject.csp" />
    <ItemGroup>

    <Target Name="Build">
      <CodeSmith ProjectFiles ="@(CspFiles)" Property="StringProperty=test;" />
    <Target>

Find More information on MSBuild Tasks.