【发布时间】:2017-03-29 17:53:06
【问题描述】:
我想为我的 .net 核心类库创建一个 nuget 包。
- 我将 nuget.exe 文件复制到了我的解决方案的根文件夹中
-
运行 nuget spec 和创建的 Solution.nuspec 文件。我修改如下:
<?xml version="1.0"?> <package > <metadata> <id>Solution</id> <version>1.0.0</version> <authors>cc Team</authors> <owners>cc</owners> <licenseUrl></licenseUrl> <projectUrl></projectUrl> <iconUrl></iconUrl> <requireLicenseAcceptance>false</requireLicenseAcceptance> <description></description> <releaseNotes></releaseNotes> <copyright>Copyright 2017</copyright> <tags>c# .net</tags> <dependencies> <dependency id="NETStandard.Library" version="1.6.1" /> </dependencies> <references> <reference file="Solution.dll" /> </references> </metadata> <files> <file src="Solution.dll" target="lib\netstandard1.6\Solution.dll"/>
我的解决方案的文件的节点 src 值 outpupath。 (bin\Release\netstandard1.6\Solution.dll)
- 运行 nuget pack Solution.nuspec 并创建 Solution.nupkg 文件。
- 我把它放到了我的包源中。
- 创建一个新的 .net 核心类库并从本地包源中选择我的解决方案 nuget 包。它添加到我的项目中。没有错误或警告。但是当我尝试从我的解决方案 nuget 包中访问一个类时,找不到它。我下载了“Nuget 包资源管理器”并打开了我的 Solution.nupkg。我可以在 lib --> netstandart1.6 下看到 Solution.dll 和 Solution.pdb 文件。
然后我搜索了错误并发现了这个:
"scripts": {
"postcompile": [
"dotnet pack --no-build --configuration %compile:Configuration%"
]
}
编译我的解决方案项目后,它会创建解决方案.1.0.0-0.nupkg 文件和解决方案.1.0.0-0.symbols。我把它放到我的本地包源中,但这些包没有在“Nuget 包管理器”中列出。
你有什么想法吗?
【问题讨论】:
标签: c# .net visual-studio-2015 nuget-package nuget-spec