首页 > 解决方案 > 如何在我的 vsix 项目中重命名解决方案文件(IWizard 实现)

问题描述

我有一个 vsix 项目,用于创建具有多个项目的解决方案。我遇到的问题是如何重命名解决方案文件。

我试过了

    public void RunStarted(object automationObject,
        Dictionary<string, string> replacementsDictionary,
        WizardRunKind runKind, object[] customParams)
    {
        try
        {
            if (replacementsDictionary[ParameterKey.EnteredProjectName] == replacementsDictionary[ParameterKey.SolutionName] 
                && ! replacementsDictionary[ParameterKey.EnteredProjectName].ToLower().Contains("restapi"))
                replacementsDictionary[ParameterKey.SolutionName] = String.Concat(replacementsDictionary[ParameterKey.SolutionName], ".RestAPI");               
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.ToString());
        }
    }

    public class ParameterKey
    {
        internal const string MachineName= "$machinename$";
        internal const string EnteredProjectName = "$projectname$";
        internal const string Organization = "$registeredorganization$";
        internal const string SafeProjectName = "$safeprojectname$";
        internal const string SolutionName = "$specifiedsolutionname$";
        internal const string Username = "$username$";
        internal const string Time = "$time$";
    }

这不起作用。

我关注了这篇文章

标签: c#code-generationvisual-studio-templates

解决方案


推荐阅读