- Embed the license file into your application as an embedded resource in the assembly that calls the CodeSmith.Engine.
- Place the license file into the same directory as your application.
- Specify a license key via the Generator:License environment variable or in code via the CodeSmithLicense.SetLicenseKey(key) method. We only recommend this for build/web servers as this will overwrite any locally defined licenses.
Creating a new project
In order to use the CodeSmith Generator SDK you will need to create a new .Net 4.0 6.2 or newer project. In the example below, we will be creating a new console application.
Next, you are required to reference the following assemblies:
|These assemblies will be located in the CodeSmith Generator's Program Files folder if you installed CodeSmith Generator.|
In the example below we will also need to reference the following assembliesNuGet packages:
Writing the Code
Now it's time to dive in and write some generation code! We will add the following code to our console application:
The above code will compile and run but requires the Stored Procedures template that can be found in the APISample project that was mentioned above. If you have any SDK API questions feel free to contact support.