Can NuGet add a .cs file to the destination project?

Just put your .cs file in a folder called "content", at the root of the package.

from the docs:

"you can layout a directory structure that follows the NuGet conventions.

tools - The tools folder of a package is for PowerShell scripts and programs accessible from the Package Manager Console. After the folder is copied to the target project, it is added to the `$env:Path (PATH) environment variable.

lib - Assemblies (.dll files) in the lib folder are added as assembly references when the package is installed.

content - Files in the content folder are copied to the root of your application when the package is installed.

Think of the Content folder as the root of your target application. For example, if I want a package to add an image in the /images directory of the target application, make sure to place the image in the Content/images folder of the package."

see: http://docs.nuget.org/docs/creating-packages/creating-and-publishing-a-package#From_a_convention_based_working_directory


You can also use the <files> section of the nuspec to move your file into the content folder when the package is being built:

<?xml version="1.0"?>
<package>
  <metadata>
    ...
  </metadata>
  <files>
    <file src="App.Template.config" target="content" />
    <file src="Program.template.cs" target="content" />
  </files>
</package>