2010-09-01 9 views
5

लोड करता है मैं सेटिंग्स फ़ाइल लोड करने के लिए बस एक रास्ता (शायद एक मैक्रो?) ढूंढ रहा हूं। आदर्श रूप से मैं इसे डेस्कटॉप से ​​शॉर्टकट के रूप में चलाने में सक्षम होना चाहता हूं। मैंने इसे गुगल किया, लेकिन शायद मैंने सही कीवर्ड नहीं मारा।विजुअल स्टूडियो 2010 में मैक्रो जो सेटिंग्स फ़ाइल

उत्तर

5

यह एक मैक्रो है जो मेरे लिए काम करता है।

Sub MySub() 
    DTE.ExecuteCommand("Tools.ImportandExportSettings", "/import:""<full path to settings file>""") 
End Sub 

कुछ डॉक्स here

0

PowerShell में:

function Import-VisualStudioSettingsFile { 
    [CmdletBinding()] 
    param(
     [string] $FullPathToSettingsFile, 
     [string] $DevEnvExe = "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe", 
     [int] $SecondsToSleep = 20 # should be enough for most machines 
    ) 

    if(-not (Test-Path $DevEnvExe)) { 
     throw "Could not find visual studio at: $DevEnvExe - is it installed?" 
    } 

    if(-not (Test-Path $FullPathToSettingsFile)) { 
     throw "Could not find settings file at: $FullPathToSettingsFile" 
    } 

    $SettingsStagingFile = "C:\Windows\temp\Settings.vssettings" # must be in a folder without spaces 
    Copy-Item $FullPathToSettingsFile $SettingsStagingFile -Force -Confirm:$false 

    $Args = "/Command `"Tools.ImportandExportSettings /import:$SettingsStagingFile`"" 
    Write-Verbose "$Args" 
    Write-Host "Setting Tds Options, will take $SecondsToSleep seconds" 
    $Process = Start-Process -FilePath $DevEnvExe -ArgumentList $Args -Passthru 
    Sleep -Seconds $SecondsToSleep #hack: couldnt find a way to exit when done 
    $Process.Kill() 
} 
संबंधित मुद्दे