从命令行导出/导入Visual Studio设置 [英] Export/Import Visual Studio Settings from Command Line
问题描述
如何从命令行或使用C#导出/导入VS 2010/2012设置?甚至不借助GUI自动化是否有可能?
How do I export/import VS 2010/2012 settings from the Command Line or using C#? Is it even possible without resorting to GUI Automation?
推荐答案
您可以通过提供带有/ResetSettings
参数的设置文件来实现导入.
You can achieve import by providing a settings file with the /ResetSettings
argument.
devenv /ResetSettings c:\full\path\to\your\own.vssettings
这从VS2005开始有效.
This works from VS2005 onwards.
尽管您可以从命令行导入,但AFAIK从命令行没有导出功能.为此,您可以使用宏:
Although you can import from the command line, AFAIK there is no export functionality from the commandline. For that you could use a macro:
Sub ExportMacro()
DTE.ExecuteCommand("Tools.ImportandExportSettings", "/export:own.vssettings")
End Sub
或者通过命令行C#应用程序(/参考EnvDte)
Or from a commandline c# application (/reference EnvDte)
static void Main(string[] args)
{
var filename = "own.vssettings";
var dte = (EnvDTE.DTE) System.Runtime.InteropServices.Marshal.
GetActiveObject("VisualStudio.DTE"); // version neutral
dte.ExecuteCommand("Tools.ImportandExportSettings", "/export:" + filename);
}
要从宏和/或c#程序中导入,请将/export 替换为/import
To import the from the macro and/or c# program replace /export with /import
这篇关于从命令行导出/导入Visual Studio设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!