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

标签 c# visual-studio-2010 nuget nuget-package project-template

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

问候

最佳答案

在 RunStarted 方法中,使用 replacementsDictionary["$destinationdirectory$"] 包含目标目录。

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

}

您可以在生成的代码文件中使用“$destinationdirectory$”。

我找到了这个答案 here

关于c# - 在 VS 项目模板向导中获取解决方案/项目的位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17344881/

相关文章:

c# - 获取传递给子模块 (C#.NET dll) 内的主模块 (VC++ exe) 的参数

c# - 如何从收到的 msmq 消息中获取发件人的 WindowsIdentity?

css - Visual Studio 2010 : Positioning an ASP NavigationMenu control

visual-studio - 如何在 Nuget 的 install.ps1 中添加 PreBuildEvent

c# - JsonServiceClient 似乎未包含在程序集中

c# - iOS 上的 Xamarin Forms,调试元素变为 null

c# - 未找到 Microsoft.web.Infrastructure.dll - Visual Studio 2015

c# - 占位符控件集合在回发时为空

visual-studio-2010 - 除非我手动选择 "Rebuild",否则 Visual Studio 2010 不会重建更改的代码

.net - 如何安装与.net 4.0兼容的json.net版本?