我有一个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>
我该如何解决这个问题?