2016-12-28 18 views
0

다른 프로젝트 유형 중에서 웹 사이트 프로젝트가 포함 된 솔루션 파일이 있습니다. 게시 프로필을 사용하여 배포하고 전체 빌드를 TFS (2015)로 옮겨 빌드 및 배포 프로세스를 자동화하려고합니다. 명시된 바와 같이 here 웹 사이트 프로젝트이므로 빌드 구성을 관리 할 수 ​​없으므로 결과적으로 Web.config Transformation feature을 사용할 수 없습니다.TFS 빌드 단계로 수동 구성 변환

저는 일종의 변형을 실행하고 싶습니다. 아마도 빌드 단계 일 것입니다. 수동으로 web.release.config 파일을 만들고 유지 관리 할 수 ​​있지만 수동으로 변환하는 방법을 모르겠습니다. XLST 파일이 Visual Studio 외부에서 변환되도록 존재합니까 (예 : cmd 빌드 단계에서 XSLT 프로세서 호출)?

추가 정보 : 웹 프로젝트로 변환하는 것이 가장 확실하게 문제를 해결할 수 있지만 TFS 빌드 수준의 솔루션을 제공하는 원격 계약자의 개입이 필요하기 때문에 해결책은 아닙니다. 내가 찾고 있어요.

+0

응용 프로그램의 안정성과 일관성뿐만 아니라 추가 기능을 얻으려면 프로젝트를 웹 응용 프로그램으로 변경해야합니다. –

+0

CeCe의 솔루션으로 문제가 해결 되었습니까? –

+0

추가 기본 파일 (빌드 프로세스 중에 참조되지 않도록 개발 중에 사용 된 web.config가 원인)이 필요하거나 web.config에 토큰이 저장되어 있어야하기 때문에 필자는 그렇게 생각하지 않습니다. 로컬 자체 빌드 후 단계가 추가되지 않으면 로컬로 토큰 바꾸기를 수행하지 않는 한 개발 중에 web.config를 쓸모 없게 만듭니다 (플러그인을 올바르게 이해하고있는 경우). – mlhDev

답변

0

내 실제 변환 내가 변환이 XSL을 개발 비교적 간단 이었기 때문에 : 몇 가지 명백한 단점을 가지고

<?xml version="1.0" encoding="utf-8"?> 
<xsl:stylesheet version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" 
    exclude-result-prefixes="msxsl"> 
    <xsl:output method="xml" indent="yes"/> 
    <xsl:variable name="xformPath">web.Prod.config</xsl:variable> 
    <xsl:variable name="xform" select="document($xformPath)"></xsl:variable> 

    <xsl:template match="@* | node()"> 
    <xsl:copy> 
     <xsl:apply-templates select="@* | node()"/> 
    </xsl:copy> 
    </xsl:template> 

    <xsl:template name="output-transform"> 
    <xsl:param name="xformNode" /> 
    <xsl:variable name="key" select="@key" /> 
    <xsl:choose> 
     <xsl:when test="$xformNode"> 
     <xsl:copy-of select="$xformNode" /> 
     </xsl:when> 
     <xsl:otherwise> 
     <xsl:copy> 
      <xsl:apply-templates select="@* | node()"/> 
     </xsl:copy> 
     </xsl:otherwise> 
    </xsl:choose> 
    </xsl:template> 

    <xsl:template match="/configuration/appSettings/add"> 
    <xsl:variable name="key" select="@key" /> 
    <xsl:call-template name="output-transform"> 
     <xsl:with-param name="xformNode" select="$xform/configuration/appSettings/add[@key=$key]" /> 
    </xsl:call-template> 
    </xsl:template> 

    <xsl:template match="/configuration/connectionStrings/add"> 
    <xsl:variable name="name" select="@name" /> 
    <xsl:call-template name="output-transform"> 
     <xsl:with-param name="xformNode" select="$xform/configuration/connectionStrings/add[@name=$name]" /> 
    </xsl:call-template> 
    </xsl:template> 

    <xsl:template match="/configuration/system.web/customErrors"> 
    <xsl:call-template name="output-transform"> 
     <xsl:with-param name="xformNode" select="$xform/configuration/system.web/customErrors" /> 
    </xsl:call-template> 
    </xsl:template> 
</xsl:stylesheet> 

이어야 교체 할

  • 항목을 수동으로
  • 을 정의
  • 지정된 속성뿐만 아니라 전체 요소로 바꿉니다.
  • 어린이 요소를 유지 관리하지 않습니다 (예 : 내가 false-system.web/[email protected]을 변경하려하지만 난 내 비주얼 스튜디오 빌드 단계 및 파일 복사 단계 사이에, 명령 줄 단계에서이를 추가하고, 전화를 계획

내 모든 system.web/compilation/assemblies 항목)를 분실하거나 msxsl.exe 또는 Saxon의 HE 변환 엔진.

0

@MrHinsh는 주석에서 언급했듯이 웹 사이트 프로젝트에는 기본적으로 web.release.config 파일이 없으므로 웹 사이트 프로젝트 대신 웹 응용 프로그램 프로젝트를 만드는 것이 좋습니다.

파일의 토큰을 변수 값으로 바꾸려면 빌드 정의에 Replace Tokens 작업을 추가 할 수 있습니다.

enter image description here