C# 在VS项目模板向导中获取解决方案/项目的位置

C# 在VS项目模板向导中获取解决方案/项目的位置,c#,visual-studio-2010,nuget,nuget-package,project-template,C#,Visual Studio 2010,Nuget,Nuget Package,Project Template,我正在为项目模板实现一个向导,我想获取用户在“新建项目”窗口中选择的项目/解决方案路径。我知道有一些参数,比如$saferootprojectname$可以获取项目名称,但不知道如何获取位置路径 关于RunStarted方法,请使用replacementsDictionary[“$destinationdirectory$”]包含目标目录 public void RunStarted(object automationObject, Dictionary<string,string>

我正在为项目模板实现一个向导,我想获取用户在“新建项目”窗口中选择的项目/解决方案路径。我知道有一些参数,比如$saferootprojectname$可以获取项目名称,但不知道如何获取位置路径


关于RunStarted方法,请使用replacementsDictionary[“$destinationdirectory$”]包含目标目录

public void RunStarted(object automationObject, Dictionary<string,string> replacementsDictionary, WizardRunKind runKind, object[] customParams) 
{    
     string Path=replacementsDictionary["$destinationdirectory$"];

}
public void RunStarted(对象自动对象、字典替换Dictionary、向导runKind runKind、对象[]customParams)
{    
字符串路径=replacementsDictionary[“$destinationdirectory$”];
}
您可以在生成的代码文件中使用“$destinationdirectory$”

我找到了这个答案