我有一個ClickOnce應用程序,它有一些「模式」。我創建了一個MSBuild腳本,它使用.csproj
文件(C#/ Visual Studio項目文件)和app.config
文件上的XSL變換來設置應用程序將部署到的不同環境的配置參數。使用MSBuild發佈多個ClickOnce應用程序時的應用程序名稱問題
腳本中的步驟是構建軟件的所有Office版本,其中有三個版本,分別爲每個文件轉換app.config
和.csproj
文件。之後它將爲卡車版本的軟件做同樣的事情併發布這些。這全部發布到本地文件夾,然後壓縮到我們發送給客戶端的ZIP文件中。
我已經完成了所有這些工作,但我現在遇到的問題是應用程序名稱內部的.application文件以某種方式被髮布進程緩存。因此,所有「卡車」版本都在publish.htm
頁面上表示Mobile,但是當我們單擊安裝鏈接時,它會在彈出的安裝對話框中顯示Office版本。
當我檢查貨車版在文本編輯器我看到下面的部署標籤.application
文件:
<description co.v1:suiteName="Prover"
asmv2:product="Prover Office"
xmlns="urn:schemas-microsoft-com:asm.v1" />
它指向的發佈操作可能以某種方式緩存我的產品名稱,而不是正確地改變它。
我試圖改變發佈操作的順序來首先發布卡車版本,在這種情況下,產品標籤會在所有Office版本上說Prover卡車。
我已經厭倦了放入RemoveDir命令以在每次發佈之前清除項目內部的/ bin文件夾,以確保沒有任何內容以這種方式獲取緩存。但是這並沒有解決問題。
正在呼籲看起來像這樣的目標:
<Target Name="EnbridgeOfficeDevPublish"
AfterTargets="JDPOfficePublish"
DependsOnTargets="CreatePublishDir;">
<RemoveDir Directories="$(MSBuildProjectDirectory)\EBPMND_Prover\Bin"/>
<!--Transform .csproj file-->
<XslTransformation
XslInputPath="$(MSBuildProjectDirectory)\Deployment\OfficeCSProj.xslt"
XmlInputPaths="$(MSBuildProjectDirectory)\EBPMND_Prover\EBPMND_Prover.csproj"
OutputPaths="$(MSBuildProjectDirectory)\EBPMND_Prover\EBPMND_Prover.transformed"
Parameters="<Parameter Name='ApplicationVersion' Value='$(Version)'/>"/>
<Copy SourceFiles="$(MSBuildProjectDirectory)\EBPMND_Prover\EBPMND_Prover.transformed"
DestinationFiles="$(MSBuildProjectDirectory)\EBPMND_Prover\EBPMND_Prover.csproj"
OverwriteReadOnlyFiles="true" />
<Delete Files="$(MSBuildProjectDirectory)\EBPMND_Prover\EBPMND_Prover.transformed"/>
<!--Transform app.config-->
<XslTransformation
XslInputPath="$(MSBuildProjectDirectory)\Deployment\OfficeDevAppConfig.xslt"
XmlInputPaths="$(MSBuildProjectDirectory)\EBPMND_Prover\app.config"
OutputPaths="$(MSBuildProjectDirectory)\EBPMND_Prover\app.config.transformed"/>
<Copy
SourceFiles="$(MSBuildProjectDirectory)\EBPMND_Prover\app.config.transformed"
DestinationFiles="$(MSBuildProjectDirectory)\EBPMND_Prover\app.config"
OverwriteReadOnlyFiles="true" />
<Delete Files="$(MSBuildProjectDirectory)\EBPMND_Prover\app.config.transformed"/>
<MSBuild
Projects="EBPMND_Prover\EBPMND_Prover.csproj"
Properties="Configuration=Release;InstallUrl=http://houvwebd/Prover/;PublishDir=$(PublishDir)\OfficeDev\;ApplicationVersion=$(Version)"
Targets="Publish"/>
<Message Text="------Dev Office Publish Completed-----"/>
</Target>
而且XSL文件是非常簡單的。以下是一個.csproj
XSL文件的示例。
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="build:PropertyGroup/build:ProductName">
<ProductName>Prover Truck</ProductName>
</xsl:template>
<xsl:template match="build:PropertyGroup/build:InstallUrl">
<InstallUrl>http://houvwebd/Prover/Truck/</InstallUrl>
</xsl:template>
<xsl:template match="build:PropertyGroup/build:PublishUrl">
<PublishUrl>D:\Projects\PrecompiledWeb\Prover\Truck\</PublishUrl>
</xsl:template>
<xsl:template match="build:PropertyGroup/build:CreateDesktopShortcut">
<CreateDesktopShortcut>true</CreateDesktopShortcut>
</xsl:template>
<xsl:template match="build:ApplicationVersion">
<ApplicationVersion>
<xsl:value-of select="$ApplicationVersion"/>
</ApplicationVersion>
</xsl:template>
<xsl:template match="build:PropertyGroup/build:Install">
<Install>True</Install>
</xsl:template>
<xsl:template match="build:SignManifests">
<SignManifests>false</SignManifests>
</xsl:template>
我該如何解決這個問題?