7

I'm trying to set up automated builds on my build agent using MSBuild on the command line. The two projects I'm focussed on at the moment are a UWP and it's associated unit test project.

To build, I have to use this:

/p:AppxPackageSigningEnabled=false

Else, I get this error:

error APPX0101: A signing key is required in order to package this project. Please specify a PackageCertificateKeyFile or PackageCertificateThumbprint value in the project file.

However, this does not generate a .cer security certificate. So when I run vstest.console.exe, I get this error:

error 0x800B0100: The app package must be digitally signed for signature validation..

Question: Can vstest.console.exe be made to run without a .cer, and if not, how can I get everything building and my tests running as well? I don't want devs to use temporary .pfx files.

Ash
  • 2,021
  • 2
  • 26
  • 59
  • use the same commant while running: /p:AppxPackageSigningEnabled=false as a parameter It is an MSBuild parameter it will create a unsigned package. – shrot Mar 23 '18 at 07:16
  • @shrot Sorry I don't quite follow. Do you mean I should pass that same parameter `/p:AppxPackageSigningEnabled=false` to vstest.console.exe? – Ash Mar 23 '18 at 07:26
  • yes pass the same parameter to vsts.console.exe along with the dlls of the build. – shrot Mar 23 '18 at 07:31
  • @shrot It complains with an error saying unrecognised parameter. Also, there are no dlls. It’s UWP so just an appx. – Ash Mar 24 '18 at 08:52
  • Seriously? Downvoting? Step forward and maybe explain yourself whoever you are. – Ash Mar 25 '18 at 22:01

2 Answers2

3

A UWP package must be signed, so it should not be able to made to run without a .cer. Please see the Best Practices for Signing Certificates and Create a certificate for package signing topics to create a signing certificate firstly.

Breeze Liu - MSFT
  • 3,734
  • 1
  • 10
  • 13
  • Thanks. I’ve already seen those pages (which really need updating). And I’ve successfully created a certificate and singed the app via command line. I really just needed to know if all that’s necessary. Where is it documented that UWP apps need to be signed in order to run them, in precisely those words or equivalent? And if that really is the case, what’s the point of `/p:AppxPackageSigningEnabled=false`? – Ash Mar 26 '18 at 07:21
  • @Ash Error will occur when you deploy a Windows Store app packages if the package is unsigned, see the **0x800B0100** error code and the corresponding **Suggestions** part *Only signed Windows Store app packages can be deployed* in this document https://msdn.microsoft.com/en-us/library/windows/desktop/jj835836(v=vs.85).aspx. On other hand, the `/p:AppxPackageSigningEnabled=false` is used when sometime you will require Appxpackage not to be signed, rather to be signed by some one else. – Breeze Liu - MSFT Mar 26 '18 at 08:04
  • Thanks Breeze. Really think this should be mentioned in big bold letters on one of the getting started pages of UWP, not within some troubleshooting page under some error description. Anyway, this answers my question, so accepting. – Ash Mar 26 '18 at 08:15
2

Actually there is a way to run a UWP unit test using vstest.console.exe without having to install any certificate: Pass to vstest.console.exe the .appxrecipe file instead of the .appx file.

It will deploy the UWP unit test app from its current build location and be able to start the tests.

M'hand BOUGHIAS
  • 730
  • 10
  • 13