Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building Windows 8 Phone App on Command Line

I'm currently porting an existing cross platform framework to Windows Phone 8.

The build process is fully automated and we are using a rock solid CI system.

I can build and deploy Windows Phone 8 samples from Visual Studio (Express 2012), but now I need to integrate that into our build scripts.

Did anybody ever successfully build (and deploy) a Win Phone 8 app via the commandline? (Or ant, make, scons, whatever...)

If yes, how?

Any hints are welcome.

like image 901
Andreas Avatar asked Dec 20 '22 11:12

Andreas


1 Answers

I used the following bat file to build WP7 code (+ant automation on top of it). It may be helpful for you.

build.bat

C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe build.xml /t:BuildAndCopy /p:Revision=123

where build.xml is something like (build itself goes under BuildAll target)

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <Import Project="C:\Program Files (x86)\MSBuild\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/>
    <PropertyGroup>
        <Major>1</Major>
        <Minor>0</Minor>
        <Build>0</Build>
        <Revision>x</Revision>
        <OutputPath>Build\</OutputPath>
        <OutputPathDebug>..\Build\Debug\</OutputPathDebug>
        <OutputPathRelease>..\Build\</OutputPathRelease>
    </PropertyGroup>
    <Target Name="BuildAll" DependsOnTargets="Clean; Version">
        <msbuild  Projects="SomeApp.sln" Properties="Configuration=Release;OutputPath=$(OutputPathRelease)"/>
        <msbuild  Projects="SomeApp.sln" Properties="Configuration=Debug;OutputPath=$(OutputPathDebug)"/>
    </Target>
    <Target Name="Clean">
        <RemoveDir Directories="$(OutputPath)" Condition="Exists('$(OutputPath)')"/>
        <MakeDir Directories="$(OutputPath)" Condition="!Exists('$(OutputPath)')"/>
    </Target>
    <Target Name="Version">
        <Message Text="Version: $(Major).$(Minor).$(Build).$(Revision)"/>
        <XmlUpdate
                Namespace=""
                XmlFileName="WindowsPhone\Properties\WMAppManifest.xml"
                XPath="//App[@Version]//@Version"
                Value="$(Major).$(Minor).$(Build).$(Revision)"/>
    </Target>

    <ItemGroup>
        <AppFiles Include="$(OutputPath)\**\*.xap"/>
    </ItemGroup>

    <Target Name="BuildAndCopy" DependsOnTargets="BuildAll">
        <Copy
                SourceFiles="@(AppFiles)"
                DestinationFiles="@(AppFiles->'\\fs\Public\projects\mobile\SomeAppWP\$(Major).$(Minor).$(Build).$(Revision)\%(RecursiveDir)%(Filename)%(Extension)')"
                />
        <Copy
                SourceFiles="@(AppFiles)"
                DestinationFiles="@(AppFiles->'\\fs\Public\projects\mobile\SomeAppWP\latest\%(RecursiveDir)%(Filename)%(Extension)')"
                />
    </Target>


</Project>
like image 69
Sergei Grebnov Avatar answered Jan 22 '23 05:01

Sergei Grebnov