Wednesday, December 7, 2016

How to make a package


How to make a package


Tools needed: Nuget Package Explorer
Found at: https://docs.nuget.org/ndocs/tools/package-explorer

DotNet peek or some other way of determining dependencies for the package dlls

About NuGet packages in general:

Packages are zip files that happen to have the nupkg extention.

About the tool:

The NuGet Package Explorer is a GUI tool for creating and editing packages. It allows for a visual method of creating packages.

  1. Choose "Create a new package". Third option from the top of the "Common tasks" dialog.

  2. You'll get a screen shot like above to start with. Notice the circled buttons in the screen shot. Those are your modes for editing a package, edit metadata editing mode and metadata source editing mode.

  3. Click the pencil and paper button next to the green < > button. You will get what looks like above. Notice the blue circled areas on the screen shot. Those are the titles of the panes and the editing buttons for meta data, save and cancel.

  4. Drop the dll you want to package into the package contents side pane. You'll get the above popup too. Choose "Yes".
    1. If you want to add framework version checking to the package. Right click the pane, click "add lib folder" from the popup. Then right click the lib folder and click the "Add .Net folder" and select the version of the framework you want.
    2. If you already have a lib folder you create follow the same steps as a for starting it but you have to re-add the dll to the framework version folder you create or else the package could be corrupted.

  5. Once you've clicked "Yes" you're back to this screen with the dll now in a virtual folder.

  6. Package Dependencies - Click the edit assembly dependencies to add nuget package references to the package. You'll get a popup like above. Click the green plus sign. You can name the group by using the "Target framework" label group details. Click the little hand with a paper in the popup to navigate to the screen shot "Select Package". You may need to put in your package source and then click reload. Click the package in the list or find it using the search box. Click the package in the result list and click "open" or "show all versions" and select the version you need and then "open". Click the close button and now you're the proud owner of a package with package dependences.
  7. Save your package (Click the green check box and you'll save your package and you are now ready to save your package. Go to File, Save As. You'll see the version number in the package name. Its automatically populated from the version of your package. Leave it in the name, navigate to where you want to save it and then click save.) and deploy it to the build server nuget package location.

No comments:

Post a Comment