Giter VIP home page Giter VIP logo

nuget-packup's Introduction

NuGet Packup

NuGet Packup is a tool to create a NuGet package for the project, with getting values from AssemblyInfo.

NuGet Packup は、アセンブリの情報 (主に AssemblyInfo.cs) から必要な値を取得して、
NuGet パッケージを作成するためのツールです。

インストール方法

Visual Studio でプロジェクトを右クリックして [Nuget パッケージの管理] から NuGet Packup を検索するか、
またはパッケージ マネージャー コンソールで

Install-Package Keiho.Tools.NuGetPackup

を実行すればインストールできます。

NuGet Packup をインストールすると、NuGet.CommandLine も同時にインストールされます。
インストールが完了すると、次のファイルがプロジェクトに追加されます。

  • NuGetPackup.exe
  • Package.nuspec.xml

値の指定方法

Package.nuspec.xml は、.nuspec ファイルのテンプレートとして使用されます。
Package.nuspec.xml にある $id$, $version$ などのプレースホルダーは、
NuGet パッケージを作成するために必要なパラメーターを表します。

各プレースホルダーに代入される値は、次の表の場所から取得されます。太字は必須項目です。
AssemblyInfo.cs に最初から記述されている AssemblyFileVersion 属性などのほかにも、
AssemblyMetadata 属性を利用して値を指定しておきます。

プレースホルダー 値の取得先
$id$ プロジェクトのプロパティのアセンブリ名
$version$ AssemblyFileVersion 属性
$title$ AssemblyTitle 属性
$description$ AssemblyDescription 属性
$author$ AssemblyCompany 属性
$copyright$ AssemblyCopyright 属性
$projectUrl$ AssemblyMetadata 属性、キー ProjectUrl
$licenseUrl$ AssemblyMetadata 属性、キー LicenseUrl
$tags$ AssemblyMetadata 属性、キー Tags
$releaseNotes$ AssemblyMetadata 属性、キー ReleaseNotes

必要であれば、.nuspec ファイルの仕様に従って Package.nuspec.xml を編集します。
例えば、

  • <frameworkAssemblies> : .NET Framework アセンブリへの参照
  • <dependencies> : パッケージへの参照
  • <files> : パッケージに含めるファイル

などがよく使われると思います。
既定では、bin\Release にあるファイルをライブラリとして追加します。

実行方法

NuGetPackup.exe を実行すれば、NuGet パッケージが作成されます。
ただし、先にプロジェクトの Release ビルドを実施しておく必要があります。

動作環境

  • .NET Framework 4.5 以降

参照

補記

拡張子が .nuspec であるファイルを NuGet パッケージに含めることができないため、
ファイル名を Package.nuspec.xml としています。

nuget-packup's People

Contributors

sakapon avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.