简体   繁体   English

Nuget软件包不包含最新代码,除非在项目属性中修改了版本号

[英]Nuget package does not contain latest code unless version number is modified in project properties

This is a NuGet newbie question. 这是一个NuGet新手问题。

I have a .net core 2.0 class library project which I have just started working on. 我有一个刚刚开始进行工作的.net core 2.0类库项目。 I need to package this and install that package in a different asp.net project which is also in its initial stages. 我需要将其打包并将该软件包安装在另一个处于初始阶段的asp.net项目中。

So right now there are frequent, major changes occurring in both projects. 因此,目前两个项目都经常发生重大变化。

Right now, every time I modify something in the class library project, I package it to a .nupkg file and install it to my asp.net project so that my changes are available in the asp.net project. 现在,每次我修改类库项目中的内容时,我都会将其打包到.nupkg文件中并将其安装到asp.net项目中,以便我的更改在asp.net项目中可用。

However my issue is that when I package the library I have to keep incrementing the Package Version in the project properties, and update the package to the latest version in the asp.net project. 但是我的问题是,当我打包库时,我必须在项目属性中继续增加Package Version,并将包更新为asp.net项目中的最新版本。

Its almost as if every version is cached. 几乎就像每个版本都被缓存一样。 I have tried cleaning the solution but still no luck. 我曾尝试清洁溶液,但仍然没有运气。

I don't want to keep changing the version at this stage because I'm just starting off and have not set up CI/CD pipelines. 我不想在此阶段继续更改版本,因为我刚刚开始并且还没有设置CI / CD管道。

How can I clear off all traces of a nuget package so I can create and install a new package with updated code without having to change the version? 如何清除nuget软件包的所有痕迹,以便我可以使用更新的代码创建和安装新软件包,而不必更改版本?

You can do this. 你可以这样做。

If it's an old-style csproj (ie if you are using a "packages.config" file) then you can simply delete the %SOLUTION_ROOT%\\packages folder (or the specific packages within it). 如果它是旧式的csproj(即,如果您使用的是“ packages.config”文件),则可以简单地删除%SOLUTION_ROOT%\\ packages文件夹(或其中的特定软件包)。 The packages will get redownloaded on the next build. 这些软件包将在下一个版本中重新下载。

If it's a new-style csproj (ie you have <PackageReference> elements in your project file) then the packages are stored globally in %USERPROFILE%\\.nuget\\packages\\ . 如果是新式的csproj(即,项目文件中有<PackageReference>元素),则程序包将全局存储在%USERPROFILE%\\.nuget\\packages\\ Delete the contents of this folder (or the specific packages within it) and the package will be redownloaded on the next build. 删除该文件夹(或其中的特定软件包)的内容,该软件包将在下一个版本中重新下载。

EDIT 编辑

Just noticed that you are using a .NET Core project - in which case you are almost certainly using the new-style csproj format, so go with my 2nd suggestion :) 刚刚注意到您正在使用.NET Core项目-在这种情况下,几乎可以肯定的是您使用的是新型csproj格式,因此请遵循我的第二条建议:)

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

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