2010-09-01 38 views
5

Tôi chỉ đang tìm cách (có thể là macro?) Để tải tệp cài đặt. Lý tưởng nhất là tôi muốn có thể chạy điều này dưới dạng lối tắt từ màn hình nền. Tôi googled nó, nhưng có lẽ tôi đã không nhấn đúng từ khóa.Macro trong Visual Studio 2010 tải tệp cài đặt

Trả lời

5

Đây là macro phù hợp với tôi.

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

Một số Documents here

0

Trong 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() 
} 
Các vấn đề liên quan