2019年5月16日 星期四

[.NET] How to build .NET NuGet package

Steps to build NuGet package for 'RFID.dll'
1. nuget.exe spec RFID.dll (nuget.exe download page)
2. Edit file [RFID.dll.nuspec]
3. Create Folder [lib\Uart\Bridge\RFIDLibNet\\] and put RFID.dll in it
    Note: The folder structure is like the value of tag 'id' in RFID.dll.nuspec.
4. nuget.exe pack RFID.dll.nuspec and then Uart.Bridge.RFIDLibNet.15.6.3.2.nupkg is created

The following folder tree is my build environment

│  CreateNuGetPackages.bat
│  README.md
│
├─outputs
│      Gorilla.Uart.Bridge.RFIDLibNet.15.6.3.2.nupkg
│
├─package
│  │  Package.nuspec
│  │
│  └─lib
│      └─Gorilla
│          └─Uart
│              └─Bridge
│                  └─RFIDLibNet
│                          RFID.dll

I write a script for auto-executing some commands

@echo off
set NUGET_PATH="C:\nugetPool\nuget.exe"
nuget.exe pack "package\Package.nuspec"
echo ============================================================
echo  Create NuGet Packages
echo ============================================================
"%NUGET_PATH%" pack "package\Package.nuspec"
pause
P.S.
 Files in the folder 'lib' will be referenced and files in the folder 'build' will be copied to the output (build) folder (ex. /bin/). Furthermore, you can customize some operations for different target platform in file 'xxx.xxx.xxx.targets'.


<!--Start Code-->
<?xml version="1.0"?>
<package >
<metadata>
<id>XXXX.Uart.Bridge.RFIDLibNet</id>
<version>15.06.03.2</version>
<authors>XXXX Technology Group</authors>
<owners>XXXX Technology Group</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Silicon Uart Bridge RFID Reader lib</description>
<releaseNotes>Official DLL version</releaseNotes>
<copyright>Copyright 2017</copyright>
<tags>XXXX Silicon UartBridge RFID</tags>
</metadata>
</package>
<!--End Code-->


沒有留言:

搜尋此網誌