简体   繁体   English

如何将 nuget 预发布包发布到提要?

[英]How to publish a nuget prerelease package to a feed?

I am manually pushing nuget packages to Azure Devops feed by running nuget.exe push command.我通过运行nuget.exe push命令手动将 nuget 包推送到 Azure Devops nuget.exe push When I build my project, the AssemblyName.1.0.0.nupkg file is created and I am pushing it as:当我构建我的项目时,会创建AssemblyName.1.0.0.nupkg文件,我将其推送为:

nuget.exe push -Source URL -ApiKey key ..\AssemblyName.1.0.0.nupkg

This works fine and the package is published successfully (as package version 1.0.0).这工作正常并且包已成功发布(作为包版本 1.0.0)。 However, I am not able to publish a prerelease package like 1.0.0-beta.但是,我无法发布像 1.0.0-beta 这样的预发布包。

What I tried?我尝试了什么?

  1. I added the following in AssemblyInfo.cs :我在AssemblyInfo.cs添加了以下内容:
[assembly: AssemblyInformationalVersion("1.0.0-beta")]

When I build the project, it still generates AssemblyName.1.0.0.nupkg but not AssemblyName.1.0.0-beta.nupkg .当我构建项目时,它仍然生成AssemblyName.1.0.0.nupkg但不生成AssemblyName.1.0.0-beta.nupkg

  1. I added the following in csproj :我在csproj添加了以下csproj
<PropertyGroup>
    <PackageVersion>1.0.0-beta</PackageVersion>
</PropertyGroup>

Still it generates only AssemblyName.1.0.0.nupkg .它仍然只生成AssemblyName.1.0.0.nupkg

What I want?我想要的是?

Could you let me know how to publish a prerelease nuget package like 1.0.0-beta please?你能告诉我如何发布像1.0.0-beta这样的预发布 nuget 包吗?

EDIT:编辑:

The project's target framework is .NET Framework 4.5 .该项目的目标框架是.NET Framework 4.5

在项目文件中使用 <Version> 元素,它应该可以工作!

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

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