繁体   English   中英

无法从包的已加载项目访问创建的nuget包的dll

[英]Created nuget package's dll can not be accessable from package's loaded project

我想创建.net核心类库的nuget包。

  1. 我将nuget.exe文件复制到了我的解决方案的根文件夹中
  2. 运行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 \\发布\\ netstandard1.6 \\ Solution.dll)

  1. 运行创建的nuget pack Solution.nuspec和Solution.nupkg文件。
  2. 我把它放到我的包源中。
  3. 创建一个新的.net核心类库,然后从本地包源中选择我的Solution nuget包。 它添加到我的项目。 没有错误或警告。 但是当我尝试从我的Solution nuget包访问一个类时,找不到它。我下载了'Nuget Package Explorer'并打开了我的Solution.nupkg。 我可以在lib-> netstandart1.6下看到Solution.dll和Solution.pdb文件。

然后我搜索了错误,发现了这个:

"scripts": {
"postcompile": [
  "dotnet pack --no-build --configuration %compile:Configuration%"
]
}

编译我的解决方案项目后,它将创建Solution.1.0.0-0.nupkg文件和Solution.1.0.0-0.symbols。 我将其放在本地软件包源中,但这些软件包未在“ Nuget软件包管理器”中列出。

你有什么主意吗?

我的经验是从有时糟糕的解决方案创建程序包。 从项目文件创建包可以解决此问题。

在我清理'C:\\ Users \\ XXX.nuget \\ packages \\ Solution'文件夹并再次添加软件包后,解决了我的问题。

因为我之前尝试过格式化不良的nutget软件包。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM