使用無internet連線,沒裝visual studio的編譯機編譯方案

  • 381
  • 0

摘要:使用無internet連線,沒裝visual studio的編譯機編譯方案

當要找台單純機器異地編譯,如無internet access時,幾點需要注意的:

  1. 先裝.Net Framework bj4
  2. 若編譯機沒有安裝等套visual studio時,需要將ex: C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0(vs2010) 整個目錄 full path複製到編譯機,因為sln或csproj檔案中的編譯有target相依會用到以上目錄中的target,要嘛自己改build檔,要嘛直接複製以 上目錄的東西,建議整包複製過去編譯機比較快。
  3. nuget無法從internet下載,且nuget restore無法使 原始碼版控系統簽入簽出nuget 套件時(vs2010會有這問題,其他版本不知道),可從.sln目錄的package目錄裡有個套件的.nupkg套件檔複製到目的地,或從%AppData%\Local\NuGet \Cache有使用過的.nupkg套件檔,整個複製到編譯機上某目錄安放 ex:D:\nuget,然後修改 sln\.nuget\NuGet.targets

    <ItemGroup Condition=" '$(PackageSources)' == '' ">
        <!-- Package sources used to restore packages. By default, registered sources under %APPDATA%\NuGet\NuGet.Config will be used -->
        <!-- The official NuGet package source (https://nuget.org/api/v2/) will be excluded if package sources are specified and it does not appear in the list -->
        <!--
            <PackageSource Include="https://nuget.org/api/v2/" />
            <PackageSource Include="https://my-nuget-source/nuget/" />
        -->
        <PackageSource Include="D:\nuget" />   <- 新增
    </ItemGroup>

     

然後

C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild  MySolution.sln

C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild  MyProject.csproj

 

附上連結:continunous integration整合 自動遷出、編譯、佈署,實際做會因環境不同而採到各種問題

You're deploying it wrong! TeamCity, Subversion & Web Deploy part 1:

Some Batch File Wizardry for Automated Builds