Question

We have a requirement of creating several Windows 8 apps for tablets. There is a common solution and news apps are created by passing different resource to the same code. For Mobile it was a cakewalk - Used the Microsoft.Build.Evaluation.Project class to get the xap file.

But for Surface, building from code does not give the direct appx output, while building using MSBuild gives appx as the output.

I tried several methods to avoid calling MSBuild from C#(by creating a Command Process) like creating a zip file - myapp.appx - and then signing it using this c++ code. It didn't workout because of an extern reference and I gave up.

Then I tried to use SignTool.exe by creating a Command Process in C#. That too failed.

So, I am wondering if there is any way to build an appx directly from C# without MSBuild.

The reason why I am trying to avoid MSBuild is to get a status from the build process, which Microsoft.Build.Evaluation.Project.Build() provides.

Was it helpful?

Solution

First try adding a pfx key to your project and then try the build via Microsoft.Build.Evaluation.Project.Build() again. The pfx is required from what I read: See Candy's answer here:

MSBuild target to create the .appx package

So then the trick would be to use SignTool to get the pfx in the first place and update the project with that pfx, but first see if the above works.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top