简体   繁体   English

从 Visual Studio 自定义扩展中检测设置

[英]Detect Setting from Visual Studio Custom Extension

I am updating an existing Visual Studio extension to be compatible with Visual Studio 2019. This extension allows devs to create a custom project type.我正在更新现有的 Visual Studio 扩展以与 Visual Studio 2019 兼容。此扩展允许开发人员创建自定义项目类型。 When users click Visual Studio's "Create" button to create a new project of this custom type, the extension shows a custom form to retrieve certain info from the dev before the extension creates the project.当用户单击 Visual Studio 的“创建”按钮创建此自定义类型的新项目时,扩展程序会显示一个自定义表单,以便在扩展程序创建项目之前从开发人员那里检索某些信息。 This is accomplished from within a Wizard class library specified in the vstemplate of my extension:这是在我的扩展的 vstemplate 中指定的向导 class 库中完成的:

<WizardExtension>
    <Assembly>...Wizard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b5b18240577bb6e8</Assembly>    
    <FullClassName>...Wizard.Logic.Wizard</FullClassName>
</WizardExtension>

My question is this:我的问题是这样的:

  • Is there a way to detect whether or not the Place solution and project in the same directory checkbox shown below is checked from within the Wizard class of my extension?有没有办法检测是否从我的扩展的Wizard class 中选中了下面显示的将解决方案和项目放置在同一目录中复选框?

在此处输入图像描述

Is there a way to detect whether or not the Place solution and project in the same directory checkbox shown below is checked from within the Wizard class of my extension?有没有办法检测是否从我的扩展的向导 class 中选中了下面显示的将解决方案和项目放置在同一目录中复选框?

I'm afraid the answer is negative.恐怕答案是否定的。 VS2019 SDK doesn't have the api to know if Place solution and project in the same directory is checked or not. VS2019 SDK没有 api 知道是否选中Place solution and project in the same directory中。 This checkbox is not a valid setting for Solution or even Project.此复选框不是解决方案甚至项目的有效设置。

Assuming your template has two forms when creating a template(Similar to asp.net web project).假设您的模板在创建模板时有两个 forms(类似于asp.net web 项目)。 Form1 is the normal one from VS IDE while the Form2 is your custom one from Wizard , the solution file and related project folder, hidden .vs folder won't be created until you click the final Create button. Form1是来自 VS IDE 的普通文件,而Form2是来自Wizard的自定义文件,解决方案文件和相关项目文件夹,隐藏.vs文件夹不会被创建,直到您单击最后创建按钮。 So I think the info about Place solution and project in the same directory is stored in temp cache before the project is finally created.所以我认为在最终创建项目之前, Place solution and project in the same directory中的信息存储在临时缓存中。 And this is hard to access in your Wizard Class.这在您的向导 Class 中很难访问。

So I think for now, what you want is not supported behavior...所以我认为现在,你想要的不是支持的行为......

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

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