Create NuGet package for Javascript Library (pt1)

In an earlier post, I wrote about how you should setup the build of a NuGet package. I really liked the simplicity of making the package out of my .csproj file. However, the package I’m working with currently only contains one minified javascript file, and it turned out that if I created the package out of the csproj-file, I got an assembly reference to the project as well.

There are people who never would use Visual Studio to make JavaScript libraries. For me, comming from a .NET background, I’m more than familiar with VS, and with the Jasmine Testrunning Setup I described earlier, I run javascript unit tests just as I have always run nUnit-tests (Ctrl + U + R). In addition I think the intellisence is splendid.

I could of course create a .nuspec file and run the package command on build. But I would run in to problems, since the NuGet update command only works if there is a newer version out there. That would mean manually change the <version> content in the nuspec-file before build in order to be able to update the package in other projects. This is just something that I can’t live with.

After a few hours of work, this was the result:

My NuGet Package, versioned after todays date in my Local Repo

What is worth noting with this picture?

  • The version of the package is 1.YYmmDD.hhMM (that is year month day [dot] hour minute – every time I build with Release Configuration, a new package will be created with an incremented version number to the previous newest version. It also has some sort of time stamp, which I like for this project since I’m not going to work with major and minor versions.
  • It’s from my local repo C:\NuGet\Repo

In my following posts, I will explain how I accomplished this.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>