2009-10-29 10 views

Répondre

0

J'ai dû modifier le nom du dossier "Fichiers d'application" par défaut pour l'un de nos clients qui n'aime pas les espaces dans les noms de fichier ou de dossier et cela signifiait re-signer le xbap après la publication. Voici le script msbuild que j'utilise pour automatiser le processus:

<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>