Install-Package NuSpec

1 minute read

If you are like me and regularly produce NuGet packages, then you often deal with NuSpec files. I always found it annoying that I had to leave my Visual Studio environment in order to create a .nuspec file. Well, I've finally automated this step and published it on Github and on the NuGet Gallery. Feel free to fork it, contribute and provide feedback!

What this package does

Plain simple:

  • It extends the NuGet Package Manager Console with a new PowerShell cmdlet, called Install-NuSpec
  • It adds the nuspec XSD's to the Solution Items solution-folder, providing you with IntelliSense when editing the nuspec file.
  • It adds a tokenized nuspec file to the target project and renames the nuspec file to .nuspec (which allows the PackageBuild feature - or nuget pack </em>- to pick it up as well) </li> </ul>
    Please note that this package obsoletes my old NuGet.Manifest.Xsd package as well.
    </td> </tr> </tbody> </table>

    Under the hood, I'm using an XML template for the generated .nuspec files, which looks like this:

    <?xml version="1.0"?>
    <!--
    This tokenized .nuspec manifest file is targeting the latest NuGet namespace,
    which ensures you can benefit from the latest packaging features.
    
    If desired, you can change the XML-namespace and target the original XSD.
    To do so, replace the current package declaration by the following:
    
    <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
    
    Run "nuget.exe pack <project>" to build a nuget package for this project
    using this tokenized nuspec file.
    
    -->
    <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
      <metadata>
        <version>$version$</version>
        <authors>$author$</authors>
        <owners />
        <id>$id$</id>
        <title />
        <requireLicenseAcceptance>false</requireLicenseAcceptance>
        <description>$description$</description>
      </metadata>
      <files />
    </package>

    Install the package use Install-Package NuSpec.

    And start using the Install-NuSpec command instead of losing time messing arround with files and windows and stuff. (kittens die when you do that)

Leave a Comment