手动XBAP发布

时间:2009-10-29 20:41:56

标签: wpf deployment publish xbap mage

我找到了一种手动发布常规WPF应用程序的方法,但我需要相同的WPF浏览器应用程序说明。以下是常规的WPF App howto:http://msdn.microsoft.com/en-us/library/xc3tc5xx(VS.80).aspx。如果有人知道我需要对我的法师命令进行哪些更改才能使其适用于XBAP,请告诉我。感谢。

1 个答案:

答案 0 :(得分:0)

我不得不为一个不喜欢文件或文件夹名称中的空格的客户更改默认“Application Files”文件夹的名称,这意味着在发布后重新签名xbap。这是我用来自动化过程的msbuild脚本:

<Target Name="PublishWebsite" DependsOnTargets="CleanWebsiteOutputPath;CleanOutputPath;CleanWebsiteReleasePath">

    <!-- Compile Website -->
    <MSBuild Projects=".\Some.Namespace.Web.Site\Some.Namespace.UI.Web.Site.csproj" Targets="Clean;Rebuild;" Properties="Configuration=Release" />

    <!-- Copy Website files to release folder -->
    <ItemGroup>
        <SiteFiles Include="Some.Namespace.UI.Web.Site/**/*.*" />
    </ItemGroup>
    <Copy SourceFiles="@(SiteFiles)" DestinationFolder="..\rel\Website\%(RecursiveDir)" />

    <!-- Remove source code and source control files from website -->
    <CallTarget Targets="CleanWebsiteAfterPublish" />
    <Message Text="Website Published" />

    <!-- Rename "Application Files" folder and re-sign the xbap -->
    <StringReplace Pattern="\." InputString="$(ApplicationVersion)" Replace="_">
        <Output PropertyName="VersionUnderscored" TaskParameter="Result" />
    </StringReplace>
    <MSBuild Projects=".\Some.Namespace.UI.WPF\Some.Namespace.UI.WPF.csproj" Targets="Publish" Properties="Configuration=Release;" />
    <Exec Command="move &quot;..\bin\Release\app.publish\Application Files&quot; &quot;..\bin\Release\app.publish\ApplicationFiles&quot;" />
    <Exec Command="$(MageExe) -update ..\bin\Release\app.publish\SomeApp.xbap –AppManifest ..\bin\Release\app.publish\ApplicationFiles\SomeApp_$(VersionUnderscored)\SomeApp.exe.manifest -wpf true -cf ..\ext\Signing\SomeApp.pfx -pwd password" />

    <!-- Move published files to Release directory -->
    <ItemGroup>
        <XbapPublishFiles Include="..\bin\Release\app.publish\**\*.*" />
    </ItemGroup>
    <Copy SourceFiles="@(XbapPublishFiles)" DestinationFiles="@(XbapPublishFiles->'..\rel\Website\%(RecursiveDir)%(Filename)%(Extension)')" />
    <Message Text="XBAP Published" />
</Target>