Detect Setting from Visual Studio Custom Extension

橙三吉。 提交于 2020-01-24 12:45:22

问题


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 ?


回答1:


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



来源:https://stackoverflow.com/questions/58944022/detect-setting-from-visual-studio-custom-extension

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!