使用.vsconfig在整个组织中配置Visual Studio

As application requirements grow more complex, so do our solutions. Keeping developers’ environments configured across our organizations grows equally complex. Developers need to install specific workloads and components in order to build a solution. Some organizations add these requirements to their README or CONTRIBUTING documents in their repositories. Some organizations might publish these requirements in documents for new hires or even just forward emails. Configuring your development environment often becomes a day-long chore. What’s really needed is a declarative authoring model that just configures Visual Studio like you need it.

随着应用程序需求变得越来越复杂,我们的解决方案也越来越复杂。 在整个组织内保持开发人员环境的配置也变得同样复杂。 开发人员需要安装特定的工作负载和组件才能构建解决方案。 一些组织将这些要求添加到其存储库中的自述文件或贡献文件中。 一些组织可能在新员工的文档中发布这些要求,甚至只是转发电子邮件。 配置您的开发环境通常成为一天的工作。 真正需要的是一个声明式创作模型,该模型可以根据需要配置Visual Studio。

In Visual Studio 2017 Update 15.9 we added the ability to export and import workload and component selection to a Visual Studio installation configuration file. Developers can import these files into new or existing installations. Checking these files into your source repos makes them easy to share. However, developers still need to import these to get the features they need.

在Visual Studio 2017 Update 15.9中,我们添加了将工作负载和组件选择导出和导入到Visual Studio安装配置文件的功能。 开发人员可以将这些文件导入新的或现有的安装中。 将这些文件检入源存储库可以使它们易于共享。 但是,开发人员仍然需要导入这些以获得所需的功能。

自动安装缺少的组件 (Automatically install missing components)

New in Visual Studio 2019: you can save these files as .vsconfig files in your solution root directory and when the solution (or solution directory) is opened, Visual Studio will automatically detect which components are missing and prompt you to install them.

Visual Studio 2019的新增功能:您可以将这些文件另存为.vsconfig文件,位于解决方案的根目录中,当打开解决方案(或解决方案目录)时,Visual Studio将自动检测缺少的组件并提示您安装它们。

This article in blog

博客中的这篇文章

You can find an example of this in the vswhere repo on GitHub. When you click the Install link, you’re prompted to install any missing components. You can click the View full installation details link if you’d like to select additional components.

您可以在GitHub上的vswhere存储库中找到此示例 。 单击“ 安装”链接时,系统将提示您安装所有缺少的组件。 如果您想选择其他组件,可以单击“ 查看完整的安装详细信息”链接。

导出配置 (Exporting your configuration)

In Visual Studio 2019, you can create a .vsconfig file right from Solution Explorer:

在Visual Studio 2019中,您可以直接从解决方案资源管理器中创建.vsconfig文件:

  1. Right-click on your solution.

    右键单击您的解决方案。
  2. Click Add > Installation Configuration File

    单击添加>安装配置文件

  3. Confirm the location where you want to save the .vsconfig file (defaults to your solution root directory).

    确认要保存.vsconfig文件的位置(默认为解决方案根目录)。
  4. Click Review details

    点击查看详细信息

  5. Select or deselect any changes you want to make and click Export

    选择或取消选择要进行的任何更改,然后单击“ 导出”

To help keep the installation footprint minimal, only export those components you know you need to build, test, and possibly publish your solution. One way you can do this is to install a second instance of Visual Studio or install into a virtual machine, add those workloads and optional components you know are necessary, and build and test your solution. Add components as needed until the solution builds successfully, then export your configuration.

为了使安装占用空间最小,请仅导出您知道需要构建,测试以及可能发布解决方案的那些组件。 做到这一点的一种方法是安装Visual Studio的第二个实例或安装到虚拟机中,添加所需的工作负载和可选组件,以及构建和测试解决方案。 根据需要添加组件,直到解决方案成功构建,然后导出配置。

反馈 (Feedback)

We love to hear your feedback! You can report a problem or make suggestions for this or any other feature in Visual Studio on our Developer Community site.

我们很高兴听到您的反馈! 您可以在我们的开发者社区网站上报告问题或为此问题或Visual Studio中的任何其他功能提出建议

Avatar
希思·斯图尔特 (Heath Stewart)

Senior Software Engineer

高级软件工程师

翻译自: https://habr.com/en/company/microsoft/blog/448800/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值