1
votes

Trying to build a Windows 8.1 store app with msbuild but getting an error. This is my first battle with msbuild and I haven't had much luck with the documentation as it all appears to leverage UWP specific things. The error I'm getting reads

C:\git\adr\win8app\src\AppDataRoom.WinRT.Adr\AppDataRoom.WinRT.Adr.csproj" (default target) (1) -> (_GenerateAppxPackageRecipeFile target) -> C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\AppxPackage\Microsoft.AppXPackage.Targets(2156,5): error APPX0702: Payload file 'C:\app\bin\x64\Release\WinRTXamlToolkit\WinRTXamlToolkit.xr.xml' do es not exist.

There are 25 other errors following all related to WinRTXamlToolkit missing inside of the bin\x64\Release folder

My msbuild command I'm running is:

msbuild .\app.csproj /p:Configuration="Release" /p:Platform="x64

I understand WinRTXamlToolKit is a nuget package and I can see the dll inside of the release folder but how what do I do to solve this error? What am I missing?

1
UPDATE: If I copy the WinRTXamlToolkit folder from the "/packages" folder under my root into the "bin/x64/Release" the build succeeds but is there a way to point at the folder instead of having to copy it? - Aaron Wirth
What is the version of the package WinRTXamlToolKit? Since you are building the windows 8.1 store app, you should use the version 1.6.1.3. I have created a windows 8.1 store app, add the package WinRTXamlToolKit with the version 1.6.1.3, then build it with your MSBuild command line, it works fine. If you are using that version package, could you please share me some detail steps so that I could reproduce this issue? - Leo Liu-MSFT

1 Answers

1
votes

I ended up finding a solution (although it still feels a little hacky). I ended up wrapping everything in an a powershell script. The script first restores the projects nuget packages, just in case it's not there for some reason. Then the script copies the WinRTXamlToolKit folder from packages into the bin/x64/Release folder and then I run the MSBuild command and now everything appears to build correctly. Here is what the script looks like (I don't write powershell scripts very often so my conventions may not be the best)

#create some alias

$nugetPath = $sourceControlRoot + ".nuget/nuget.exe";
$nugetPackagesPath = $sourceControlRoot + "/packages/";
$projectPath = $sourceControlRoot + "/TestingProject/"
Set-Alias nuget  $nugetPath 

#Nuget Restore
$solutionPath = $sourceControlRoot + "/TestingProject.sln"
nuget restore $solutionPath


#To Help MSBuild we need to copy the WinRTXamlToolkit into the bin/Release folders
$winRtXamlToolkitPath = $nugetPackagesPath + "WinRTXamlToolkit.1.6.1.3/lib/netcore451/WinRTXamlToolkit"
$copyOutput64 = $projectPath + "bin/x64/Release/WinRTXamlToolkit"
$copyOutput86 = $projectPath + "bin/x86/Release/WinRTXamlToolkit"
$testPath = $copyOutput64

if (!(Test-Path $testPath )) {
    Copy-Item $winRtXamlToolkitPath $copyOutput64 -recurse
    Copy-Item $winRtXamlToolkitPath $copyOutput86 -recurse
    Write-Output "WinRTXamlToolkit copied into bin folders"
}

#build the project
$buildPath = $projectPath + "TestingProject.csproj"
msbuild $buildPath /p:Configuration="Release" /p:Platform="x64"