[UWP] The certificate specified is not valid for signing

While developing UWP app setting up certificate is required in order to deploy app on other machine. On destination machine user need to install and trust this certificate. This is PowerShell script I used for generating valid certificate for signing UWP app.

 $HT = @{
  Subject = 'goran.lazic';
  KeyLength = 2048;
  HashAlgorithm = 'SHA256';
  KeyUsage = 'DigitalSignature';
  KeyExportPolicy = 'Exportable';
  KeySpec = 'Signature';
  NotAfter = (Get-Date).AddYears(15) ;
  TextExtension = @('2.5.29.37={text}1.3.6.1.5.5.7.3.3', '2.5.29.19={text}Subject Type:End Entity');
  CertStoreLocation = 'Cert:\CurrentUser\My'
}

New-SelfSignedCertificate @HT

Note that Subject should be name of publisher from application manifest file. Certificate from an example has validity period for next 15 years.
After creating new certificate export it and add into UWP application solution. After, just select that certificate in packaging setting in appxmanifest.