使用MSBuild发布多个ClickOnce应用程序时,应用程序名称出现问题

时间:2013-06-28 16:17:57

标签: xslt msbuild clickonce

我有一个ClickOnce应用程序,它有几个“模式”。我创建了一个MSBuild脚本,在.csproj文件(C#/ Visual Studio项目文件)和app.config文件上使用XSL转换来设置不同环境的配置参数。应用程序将部署到。

脚本中的步骤是构建软件的所有Office版本,其中有三个版本,为每个版本转换app.config.csproj文件。之后它将对卡车版本的软件执行相同的操作并发布它们。这全部发布到本地文件夹,然后压缩到我们发送给客户端的ZIP文件中。

我已经完成了所有这些工作,但我现在遇到的问题是.application文件中的 Application Name 以某种方式被发布过程缓存。因此,所有“卡车”版本都在publish.htm页面上显示Mobile,但是当我们点击安装链接时,它会弹出安装对话框中的 Office 版本。

当我在文本编辑器中检查Truck版本.application文件时,我看到以下部署标记:

<description co.v1:suiteName="Prover"
             asmv2:product="Prover Office"
             xmlns="urn:schemas-microsoft-com:asm.v1" />

指出发布操作以某种方式缓存我的产品名称而不是正确更改它的可能性。

我尝试更改发布操作的顺序以首先发布Truck版本,在这种情况下,Product标签将在所有Office版本上显示Prover Truck。

我已经厌倦了在每次发布之前放入一个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="&lt;Parameter Name='ApplicationVersion' Value='$(Version)'/&gt;"/>
    <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>

如何解决此问题?

1 个答案:

答案 0 :(得分:0)

在这种情况下,我最终制作了多个msbuild文件,并且当新版本提交到VCS时,我们的集成服务器将彼此独立地构建它们。我仍然没有想出这些设置在哪里或为何缓存,但至少我现在有一个解决方案。

相关问题