[英]My NuGet package doesn't seem to update in projects that use it as a dependency
Forgive what must be a very simple oversight on my part but I simply cannot get this to work as expected. 原谅我必须做的非常简单的疏忽,但是我根本无法按预期进行。
I am building a .NET Framework 4.6 Class Library that needs to be downloaded by other applications from a private nuget repository. 我正在构建.NET Framework 4.6类库,其他应用程序需要从私有nuget存储库中下载该类库。 Here is my process:
这是我的过程:
protected
with public
. public
替换了protected
的单词的所有实例。 I add a new class as well by right-clicking on the project, selecting Add Item, targeting a class and giving it the name TestClass
. TestClass
来添加一个新类。 C:\\Users\\jptak\\Downloads\\nuget.exe pack -Version 1.0.5
C:\\Users\\jptak\\Downloads\\nuget.exe pack -Version 1.0.5
Your package was pushed.
): C:\\Users\\jptak\\Downloads\\nuget.exe push MyPackage.1.0.5.nupkg MySecretCodeGoesHere -src http://my.nuget.server.goes.here.com
Your package was pushed.
): C:\\Users\\jptak\\Downloads\\nuget.exe push MyPackage.1.0.5.nupkg MySecretCodeGoesHere -src http://my.nuget.server.goes.here.com
TestClass
is not there. TestClass
不存在。 This leads me to believe that the code I am writing is not making it to the NuGet server. 这使我相信我正在编写的代码并未将其写入NuGet服务器。 Does anyone know what I am missing from this process to make the most recent version of the code get updated on the server?
有谁知道我在此过程中缺少什么以使最新版本的代码在服务器上得到更新?
This process is foreign to me as I am not a .NET developer (I work with PHP mostly). 由于我不是.NET开发人员(我主要使用PHP),因此此过程对我来说是陌生的。
Here are some more pieces of information about my IDE settings: 以下是有关我的IDE设置的更多信息:
Here is the code from my ConsoleApp5: 这是我的ConsoleApp5中的代码:
namespace ConsoleApp5
{
class Program
{
static void Main(string[] args)
{
string testclient = "testclient";
string testpass = "testpass";
string scope = "validate-contract";
string accessToken = "";
string retrievedScope = "";
MyPackage.TestClass test = new MyPackage.TestClass();
}
}
Error: TestClass does not exist in namespace. 错误:名称空间中不存在TestClass。 Did you forget an Assembly Reference?
您忘记了装配参考吗?
Here's the TestClass code in MyPackage: 这是MyPackage中的TestClass代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MyPackage
{
public class TestClass
{
public TestClass()
{
}
}
}
The NuGet server I'm using is: https://github.com/Daniel15/simple-nuget-server 我正在使用的NuGet服务器是: https : //github.com/Daniel15/simple-nuget-server
EDIT 1 Upon inspecting the .nupkg file, I can confirm that the old code is still there and that the new code has not made it into the .nupkg. 编辑1检查.nupkg文件后,我可以确认旧代码仍然存在,并且新代码尚未将其放入.nupkg。 This seems to support the idea that the problem is with the packaging process and not on the nuget server.
这似乎支持以下问题:打包过程而不是nuget服务器上的问题。 How does one refresh the dll files before each
nuget pack
/ nuget push
? 如何在每次
nuget pack
/ nuget push
之前刷新dll文件?
Bit long for a comment, not exactly an answer but here we go: 有点长的评论,不完全是一个答案,但是我们开始:
So top debugging tips for NuGet packages are: 因此,NuGet软件包的主要调试技巧是:
Download the package manually. 手动下载软件包。 A
.nupkg
file is just a zip file that can be opened with 7Zip or any other archive tool. .nupkg
文件只是可以使用7Zip或任何其他存档工具打开的zip文件。
Once inside you can inspect both the .nuspec
file that has been used to pack the package, and inside the lib
folder are the dlls that have been supplied. 一旦进入内部,您就可以检查用于打包程序包的
.nuspec
文件,以及位于lib
文件夹中的已提供的dll。
A decompiler like DotPeek or ILSpy can be used on the dll to see exactly what is going on inside the dll. 可以在dll上使用DotPeek或ILSpy这样的反编译器,以查看dll内到底发生了什么。
Possible causes of your symptoms could include the NuGet server giving a false success, or your application failing to update the package and still refering to the old one. 出现症状的可能原因包括NuGet服务器显示错误的成功,或者您的应用程序无法更新程序包而仍然引用旧的程序包。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.