Another usage is to package and distribute utilities via NuGet packages like FAKE and xUnit.Runners. To create your own tool package you need to author a NuSpec file like this:
<package> … <files> <file src="tooling\app.exe" target="tools\" /> </files> </package>
The key here is to set all your file's target to tools\. Doing that the package will be considered a solution-level NuGet package and will be available solution wide instead of only for one project.
For example if I install the xUnit.Runners package to my solution like this:
PM> Install-Package xunit.runners
You will see that only a new package.config file will be created in the .nuget folder at the root of your solution. This is where all solution-level packages will be referenced. Nothing will actually change inside your projects.
After that all the files required to run the xUnit runner from the command line, PowerShell or a build script will be available from the \packages\xunit.runners.1.9.2\tools folder.
The power of NuGet doesn't stop there but we'll check that in another blog post.
No comments:
Post a Comment