2016-03-12 25 views
0

我需要在應用程序構建過程中更改我的應用程序清單,並嘗試爲此使用MSBuildCommunityTasks。目標我用什麼樣子:錯誤的XPath Package.appxmanifest(XML)

<XmlUpdate 
     Namespace="" 
     XmlFileName="$(ManifestFile)" 
     XPath="//Identity[@Version]/@Version" 
     Value="$(App_Version).$(Revision)"/> 

但當構建過程開始我只得到這樣的:

Updating Xml Document "Package.appxmanifest". 0 node(s) selected for update. 

我的XPath是錯誤的。我嘗試使用XPath實時驗證程序,但我無法爲此文件選擇正確的XPath表達式,因此我需要一些幫助。

我的清單文件:

<?xml version="1.0" encoding="utf-8"?> 
<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest" xmlns:m2="http://schemas.microsoft.com/appx/2013/manifest" xmlns:m3="http://schemas.microsoft.com/appx/2014/manifest" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"> 
    <Identity Name="1234567890" Publisher="12345678" Version="9.9.9.999" /> 
    <mp:PhoneIdentity PhoneProductId="123456789" PhonePublisherId="1234567890" /> 
    <Properties> 
    <DisplayName>Name</DisplayName> 
    <PublisherDisplayName>PlaceHolder</PublisherDisplayName> 
    <Logo>Assets\StoreLogo.png</Logo> 
    </Properties> 
    <Prerequisites> 
    <OSMinVersion>6.3.1</OSMinVersion> 
    <OSMaxVersionTested>6.3.1</OSMaxVersionTested> 
    </Prerequisites> 
    <Resources> 
    <Resource Language="x-generate" /> 
    </Resources> 
    <Applications> 
    <Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="DT.PlaceHolder.WP.App"> 
     <m3:VisualElements DisplayName="PlaceHolder" Square150x150Logo="Assets\Logo.png" Square44x44Logo="Assets\SmallLogo.png" Description="PlaceHolder" ForegroundText="light" BackgroundColor="transparent"> 
     <m3:DefaultTile Wide310x150Logo="Assets\WideLogo.png" Square71x71Logo="Assets\Square71x71Logo.png"></m3:DefaultTile> 
     <m3:SplashScreen Image="Assets\SplashScreen.png" /> 
     </m3:VisualElements> 
    </Application> 
    </Applications> 
    <Capabilities> 
    <Capability Name="internetClientServer" /> 
    <DeviceCapability Name="location" /> 
    </Capabilities> 
</Package> 

回答

0

我找到了解決辦法。這適用於我:

<XmlUpdate 
     Namespace="" 
     XmlFileName="$(ManifestFile)" 
     XPath="//*[local-name()='Identity']/@Version" 
     Value="$(App_Version).$(Revision)"/>