[英]Automate Artifactory NuGet download during build in Visual Studio
I have been working with Artifactory NuGet packages in Visual Studio 2019 recently, and have a workflow which looks sort of like this:我最近一直在 Visual Studio 2019 中使用 Artifactory NuGet 包,并且有一个看起来像这样的工作流:
I need to eliminate the need for a user to know how to go through these steps, and make it as simple as possible for a Visual Studio 2019 project to automatically install a specific version of my private NuGet package hosted in artifactory.我需要消除用户知道如何完成这些步骤的需要,并使 Visual Studio 2019 项目尽可能简单地自动安装托管在 artifactory 中的我的私有 NuGet 包的特定版本。
I've been trying to accomplish this but with no luck, I'm not sure if this would best be done by editing the Visual Studio project file, or by editing the windows global nuget.config file, or create a custom nuget.config file for my visual studio project.我一直在尝试完成此操作,但没有运气,我不确定是否最好通过编辑 Visual Studio 项目文件、编辑 Windows 全局 nuget.config 文件或创建自定义 nuget.config 来完成我的视觉工作室项目的文件。
Any advice/help would be appreciated, thanks.任何建议/帮助将不胜感激,谢谢。
Since your question does not contain relevant information like if you're using a Visual Studio Solution ( *.sln
file), Git, etc., I can only have a guess 😉由于您的问题不包含相关信息,例如您是否使用 Visual Studio 解决方案(
*.sln
文件)、Git 等,我只能猜测😉
Assuming you're using Git and having a folder structure like this:假设您正在使用 Git 并具有如下文件夹结构:
- MyProject
- .git
- MyProject.sln
- ProjectA
- ProjectA.csproj
- ProjectB
- ProjectB.csproj
Now you can create a file MyProject/NuGet.config
with the following content and put it under version control:现在您可以创建一个包含以下内容的文件
MyProject/NuGet.config
并将其置于版本控制之下:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="Your Artifactory source" value="https://your.artifactory.source/v3/index.json" />
</packageSources>
</configuration>
According to the docs , NuGet should pick up NuGet.config
automatically.根据文档,NuGet 应该自动获取
NuGet.config
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.