简体   繁体   English

在 Visual Studio 中构建期间自动下载 Artifactory NuGet

[英]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 包,并且有一个看起来像这样的工作流:

  1. Add private Artifactory repo as NuGet Package Source将私有 Artifactory 存储库添加为 NuGet 包源
  2. Download specific older version of my NuGet package [either using Package Manager UI or Package Manager Console]下载我的 NuGet 包的特定旧版本 [使用包管理器 UI 或包管理器控制台]
  3. Once NuGet package is installed, build VS2019 project安装 NuGet 包后,构建 VS2019 项目

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.

相关问题 Nuget 带有 ARTifactory 的 Visual Studio 中的符号服务器不工作 - Nuget Symbol Server in Visual Studio with ARtifactory is not working 从 Visual Studio 中对 Artifactory 上的 NuGet 进行身份验证 - Authentication to NuGet on Artifactory from within Visual Studio Artifactory-从Visual Studio Feed中隐藏NuGet软件包版本 - Artifactory - Hide NuGet Package Version From Visual Studio Feed Artifactory 中的 Nuget 包未显示在 Visual Studio 中的可用包中 - Nuget package in Artifactory does not show up in available packages in Visual Studio 在 Visual Studio 构建和 nuget 恢复命令期间忽略 packages.config 文件 - packages.config file is ignored during Visual Studio Build and nuget restore commands Visual Studio Build 不会在没有项目引用的情况下下载所有 NuGet 包 - Visual Studio Build does not download all NuGet packages without a project reference 如何在Visual Studio 2010中自动化构建过程 - How to automate build process in Visual Studio 2010 如何自动化Visual Studio构建? - How do you automate a Visual Studio build? Visual Studio - 如何自动化构建过程? - Visual Studio - how to automate build process? Visual Studio 未在生成时创建 nuget package - Visual Studio not creating nuget package on build
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM