/CreateNugetPackagesFromAssemblies

Create NuGet packages from assemblies specified by folder and filter string, ie. wrap those assemblies!

Primary LanguagePowerShell

CreateNugetPackagesFromAssemblies

Slightly improved original implementation, credits:

Create packages

NuGet.exe must be on your PATH. You can install it by running choco install NuGet.CommandLine.

To create NuGet packages from assemblies in a folder with filenames starting with a given prefix run this:

& .\CreateNugetPackagesFromAssemblies.ps1 `
    -Path 'C:\PathToFolderWithAssemblies\' `
    -NameStartsWith 'FileNamePrefix' `
    -TargetPath 'C:\PathToFolderWithNuGetPackages\'

It will go through the assemblies and create NuGet packages:

  • NuGet dependencies will be inferred from assembly references
  • package version and other metadata will be extracted from assembly metadata
  • does not handle target framework(s) in any way

Attention: For some assemblies it could matter if you run the script under x86 or x64 variant of PowerShell!

Push to NuGet feed

When you are done with the packages, you can push them to a NuGet feed (provided that you have it added as a source in NuGet configuration):

nuget.exe push -Source "YourFeed" -ApiKey AzureDevOps package.nupkg

You can use wildcards in the package specification.