Archive for category nuget
These steps were written from the mindset of adding a package to the nuget gallery on nuget.org that you require and happens to be missing. Anyone can add a package to nuget.org for any project, even if you’re not a project contributor (although that is ideal). At Russell, we use a LOT of open source frameworks. While upgrading a portion of our code today, we decided to use nuget. The first road bump we found was that nuget.org did not have a package for Castle.Services.Transaction. So what’s a open source loving dev gonna do then? Why, submit a package for it of course!
Steps to add a new package to nuget.org (I’m making a lot of assumptions here, such as you know how to work the command prompt):
1) Make sure you have the nuget.exe command line tool. If not, download the latest from here (or the complex site here) and stick it somewhere accessible from your path (I use d:\dev\tools). If you already have nuget.exe, you can run ‘nuget update’ to get the latest version. More details here from David Ebbo
2) Download the released version of the package you want to add, in this example I’m using Castle.Services.Transaction, which I downloaded from http://www.castleproject.org/castle/download.html
3) Create an empty folder for the package, such as Castle.Services.Transaction, then create a subfolder called ‘lib’
5) Delete ALL dependencies in the lib folder. Castle.Services.Transaction depends on Castle.Core, but you do not want to include these in this package since Nuget handles dependencies for you. The only binaries you want to include will be the binaries specifically for the project.
6) Create the manifest file by running the nuget spec command, with the –a [assembly location]. You’ll want to make sure you’re NOT inside the folder you created for this project. The .nuspec file will be created in your current folder.
7) Open the nuspec manifest and add the missing information. The Castle.Services.Transaction manifest is at the end of this email.
8) Now we get to generate the actual package. Run the nuget pack command, the first parameter is the .nuspec manifest, the –b parameter is the folder you created for the project, and the –o parameter is the output folder for the package. The –v parameter is for verbose output:
9) Login to nuget.org, and click on “Contribute”, then “Add New Package”
That’s all there is to it. More information on creating packages can be found here: http://nuget.codeplex.com/documentation?title=Creating%20a%20Package and Phil Haack’s post, which is a little more verbose than these simple instructions.
The Castle.Services.Transaction manifest:
<?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>Castle.Services.Transaction</id> <version>2.5.0</version> <title>Castle.Services.Transaction</title> <authors>Castle Project Contributors</authors> <owners>Castle Project Contributors</owners> <licenseUrl>http://www.apache.org/licenses/LICENSE-2.0.html</licenseUrl> <projectUrl>http://www.castleproject.org/services/transaction/</projectUrl> <iconUrl>http://www.castleproject.org/images/cp_logo32.png</iconUrl> <requireLicenseAcceptance>false</requireLicenseAcceptance> <description>Castle.Service.Transaction was inspired by the Java Transaction API (JTA), although it is a simplified version with no support for two phase commit. Basically there is a transaction manager that is able to create transactions, that are associated with the thread. You can only have one active transaction per thread. The transaction object only orchestrates the resources enlisted with it. It is up to the resource implementation to provide integration with some external transaction-capable entity, typically a database connection.</description> <dependencies> <dependency id="Castle.Core" version="2.5.1" /> </dependencies> </metadata> </package>