【问题标题】:Application name issues when publishing mulitple ClickOnce applications with MSBuild使用 MSBuild 发布多个 ClickOnce 应用程序时出现应用程序名称问题
【发布时间】:2013-06-28 16:17:57
【问题描述】:

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

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

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

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

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

这表明发布操作可能会以某种方式缓存我的产品名称,而不是正确更改它。

我已尝试更改发布操作的顺序以首先发布卡车版本,在这种情况下,产品标签将在所有 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>

我该如何解决这个问题?

【问题讨论】:

    标签: xslt msbuild clickonce


    【解决方案1】:

    在这种情况下,我最终制作了多个 msbuild 文件,并在将新版本提交给 VCS 时让我们的集成服务器相互独立地构建它们。我还没有弄清楚这些设置在哪里或为什么要缓存,但至少我现在有一个解决方案。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-11-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-01-24
      • 1970-01-01
      • 2013-11-07
      • 2015-11-26
      相关资源
      最近更新 更多