简体   繁体   中英

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. 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. This is accomplished from within a Wizard class library specified in the vstemplate of my extension:

<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?

在此处输入图像描述

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?

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. 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). 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. 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. And this is hard to access in your Wizard Class.

So I think for now, what you want is not supported behavior...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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