Codesmith Generate on Build MSBuild

Generate On Build now available on NuGet

Part of the big Generator 8.0 release that launched a few weeks ago was improving Generate on Build functionality.

Previous versions of Generator required a pre-installed targets file for MSBuild integration. This was not a great option when you were trying to generate and build code on a build server or consuming Generator on a second machine because it made you install and activate Generator on that machine.

We’ve listened to the feedback and have greatly improved the MSBuild functionality by removing the pre-installed Generator MSBuild requirement and allowing you to simply install a NuGet package!

Check out the details below.

Installing & Enabling Generate on Build

You can now simply install the CodeSmith.Generator.Task NuGet package to enable Generate on Build support in your project.

Installing the NuGet package brings in MSBuild support without modifying your project file or adding any additional dependencies.  It allows you to generate project on any machine, without worrying about if Generator is installed!

Additionally, you can now set the Generator:License environment variable with your serial key to automatically activate your Server licenses on build machines! This makes continuous delivery integration (CI) and build server usage super easy.

Upgrading

As stated previously the installer no longer contains MSBuild support or Visual Studio Integration. To enable Generate On Build support, you’ll just need to right click your Generator Project File (.csp) and select the Generate On Build option to automatically download and install the CodeSmith.Generator.Task NuGet package!

generate on build targets file error

If you are getting an error about a missing targets file, you’ll need to either remove the targets file from the project file, or right click on your CodeSmith Generator Project File and, under options, disable and re-enable Generate On Build. This will remove the old targets file, which is invalid, and install the CodeSmith.Generator.Task NuGet package, which will enable Generate on Build support.