The batch file is not a necessary step in the process – it’s just a preference of mine. However, after refactoring the process to use the NuGet native commands to include files, I’m leaning toward eliminating the batch step in my process. Recall the following high-level outline of the steps used to create the NuGet package from the previous post:
- Download the NuGet Command Line tool
- Create a generic nuget nuspec file - the nuget manifest file
- Update the nuget manifest with project specific settings
Create a batch file (.bat) file that will serve as the main entry point into the nuget package creation process
- Create the nuget package
- Submit and contribute the package to the NuGet Gallery
<?xml version="1.0"?> <package xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> <id>MvcContrib.Shp</id> <version>1.0.0.0</version> <authors>Dan Ryan</authors> <owners>Dan Ryan</owners> <licenseUrl>http://mvcxgridmenu.codeplex.com/license</licenseUrl> <projectUrl>http://mvcxgridmenu.codeplex.com/</projectUrl> <requireLicenseAcceptance>false</requireLicenseAcceptance> <description>UI Extensions to the MvcContrib Project - Themed Grid & Menu</description> <tags>MVC MVC3 ASP.NET MvcContrib</tags> <dependencies> <dependency id="MicrosoftWebMvc" version="2.0" /> <dependency id="MvcContrib.Mvc3-ci" version="3.0.57.0" /> </dependencies> </metadata> <files> <file src="..\src\MvcContrib.Shp\MvcContrib.Shp\bin\Release\MvcContrib.Shp.dll" target="lib" /> <file src="..\src\MvcContrib.Shp\Shp.Web\Scripts\jquery.mvccontrib*.*" target="content\Scripts" /> <file src="..\src\MvcContrib.Shp\Shp.Web\Scripts\superfish.js" target="content\Scripts" /> <file src="..\src\MvcContrib.Shp\Shp.Web\Scripts\*jquery.hoverIntent*" target="content\Scripts" /> </files> </package>
The XML files element in the snippet above will include the child file elements in the NuGet package and place the respective file in the associated target (destination directory) of the NuGet package – the snippet above uses targets of lib and content. You can read all above the files element and other NuGet file specifications here: .nuspec File Format
Again, this is an alternative (and recommended) way to create a NuGet package. All the other steps in the high-level outline of steps (above) remains the same.
Thanks for reading…
No comments:
Post a Comment