參考資料:
一、服務器的建立
1.創建asp.net空的項目
2.添加NuGet.Server的nuget引用
3.編譯并發布到IIS服務器.
4.參考資料4中列出了網頁管理包的部分源碼,試了下,由于不完整沒弄成功.所以現在還是個最簡單的nuget服務器
二、服務器的使用
1.發布nuget包:
??1.直接將nupkg包發布到服務器的packages文件夾下
??2.使用nuget命令發布
2.使用nuget服務
??在vc的nuget設置中添加服務地址即可
三.Nuget的使用
1.生成nuspec文件
建議用PackageExplorer工具,先生成后,再手動將路徑修改成相對路徑
示例: 其中file中,src是源文件明的路徑,target是nupkg打包文件中的路徑,
metadata中的內容,根據需要修改
<?xml version="1.0" encoding="utf-8"?> <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> <metadata> <id>sw.sqlite3.v143</id> <version>3.34.1</version> <title></title> <authors>bbb</authors> <owners>sw</owners> <requireLicenseAcceptance>false</requireLicenseAcceptance> <description>My package description.</description> </metadata> <files> <file src="..\vcpkg\installed\x64-windows\include\*.h" target="build\native\include" /> <file src="..\vcpkg\installed\x64-windows\debug\bin\*.dll" target="build\native\bin\x64\debug" /> <file src="..\vcpkg\installed\x64-windows\debug\bin\*.pdb" target="build\native\bin\x64\debug" /> <file src="..\vcpkg\installed\x64-windows\debug\lib\*.lib" target="build\native\lib\x64\debug" /> <file src="..\vcpkg\installed\x64-windows\bin\*.dll" target="build\native\bin\x64\release" /> <file src="..\vcpkg\installed\x64-windows\bin\*.pdb" target="build\native\bin\x64\release" /> <file src="..\vcpkg\installed\x64-windows\lib\*.lib" target="build\native\lib\x64\release" /> <file src=".\sw.nuget.v143.targets" target="build\native\sw.sqlite3.v143.targets" /> </files> </package>
2.打包
nuget pack ***.nuspec
3.發布
nuget push mypkg.nupkg -source http://192.168.1.1/nuget -ApiKey ******
浙公網安備 33010602011771號