2017-05-07 127 views
1

Visual Studio團隊服務 - 建立&釋放Visual Studio團隊服務發佈XML轉換不起作用

在釋放定義,下文件來變換&變量替換選項,有XML轉換和XML變量替換。

我檢查了這兩個複選框,但部署後,我的Web.Dev.config中沒有內容替換web.config。轉型根本不會發生。

什麼問題?

--------編輯:詳細---------

構建

所有設置在這裏是默認的。

enter image description here

發佈

enter image description here

web.dev.config

這種轉變工作正常,如果我從Visual Studio 2015年部署

<?xml version="1.0" encoding="utf-8"?> 
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> 
    <connectionStrings> 
    <add name="DefaultConnection" connectionString="Server=tcp:xxxx.database.windows.net,1433;Database=xxxx;User [email protected];Password=xxxx;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;" providerName="System.Data.SqlClient" xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/> 
    <add name="NicoContext" connectionString="metadata=res://*/Nico.csdl|res://*/Nico.ssdl|res://*/Nico.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=tcp:xxxx.database.windows.net,1433;initial catalog=xxxx;User [email protected];Password=xxxx;App=EntityFramework&quot;" providerName="System.Data.EntityClient" xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/> 
    </connectionStrings> 
    <system.web> 
    <compilation xdt:Transform="RemoveAttributes(debug)" /> 
    </system.web> 
    <appSettings> 
    <add key="Environment" value="Dev" xdt:Transform="SetAttributes" xdt:Locator="Match(key)"/> 
    <add key="AzureStorageContainerName" value="xxx" xdt:Transform="SetAttributes" xdt:Locator="Match(key)" /> 
    <add key="StorageConnectionString" value="DefaultEndpointsProtocol=https;AccountName=xxx;AccountKey=xxx;EndpointSuffix=core.windows.net" xdt:Transform="SetAttributes" xdt:Locator="Match(key)" /> 
    <add key="FacebookLoginAppId" value="xxx" xdt:Transform="SetAttributes" xdt:Locator="Match(key)"/> 
    <add key="FacebookLoginAppSecret" value="xxx" xdt:Transform="SetAttributes" xdt:Locator="Match(key)"/> 
    </appSettings> 
</configuration> 

enter image description here

--------編輯2:不再工作---------

我一樣的解決方案在另一個Azure的帳戶一個新的項目建議,但是這一次它沒有工作。對於構建,我選擇模板「Asp.net(預覽)」,對於發佈,我選擇模板「Azure應用程序服務部署」。

enter image description here

enter image description here

--------編輯3:發佈 - 包或文件夾---------

enter image description here

+0

您使用的是什麼任務?你使用Azure應用服務部署任務嗎?什麼是詳細記錄?您可以在OneDrive上共享詳細日誌。 –

+0

什麼是你的web.config和web.dev.config的細節代碼? –

+0

謝謝,請檢查我編輯的帖子。 – martial

回答

2

你有已部署/發佈Web應用程序,因此web.config已被轉換(對於Web包部署,web.config中的相關值將在Web部署期間更新,值爲parameters.xm l)。

所以,沒有發表文件夾中的其他配置文件(e..g web.dev.config,web.release.config),並檢查XML轉換XML變量替換是沒用的。

基礎上生成日誌,Web應用程序建立與發佈配置,但沒有web.release.config,所以沒有對web.config中更新。

您可以參考以下步驟來實現您的要求:

  1. 發佈/部署與文件系統方式(如/ P的web應用程序:WebPublishMethod =文件系統/ P:publishUrl = $(建設。 artifactstagingdirectory)\)
  2. 複製文件的步驟照搬別人的配置文件(web.dev.config,web.prod.config等)添加到
  3. 添加發布構建構件
  4. 對於版本發佈的文件夾(神器目錄)取消選中使用Web發佈部署選項並將$(System.DefaultWorkingDirectory)指定爲程序包或文件夾
+0

謝謝!它的工作! – martial

+0

我有一個新的項目,我做同樣的事情,但它不再有效...... – martial

+0

@martial什麼是詳細的構建日誌?您可以打開一個新的線程,包括詳細構建日誌和簡單示例。 –

相關問題