• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by PavanJ · May 30, 2019 at 04:26 PM · windows store appuniversalcommand-linecertificatecommand line

Building UWP/WSA from Command Line with Non-Test Certificate

I'm having an issue with building my Unity project through the command line with a certificate I got from Sectigo Limited with Code Signing. The reason why I went with getting a Sectigo Limited certificate instead of getting certified through the Windows Store is because we plan on the users downloading the app directly and sideloading it and we don't want to them to set their Windows to be in Developer Mode to install it, and we don't want to distrbute through the Windows Store. So when I set the certificate I got from Sectigo Limited I set it to be the certificate to be used in Unity in the Publisher Settings. I entered the password then used the following command to build the project.

 Unity.exe -quit -batchmode -silent-crashes -serial %UNITY_SERIAL% -username %UNITY_EMAIL% -password "%UNITY_PASSWORD%" -projectPath "sensei-v2" -logFile "%BUILD_BINARIESDIRECTORY%\build.log" -buildTarget WindowsStoreApps -executeMethod BuildSensei.BuildWindowsUWP -outputDirectory %BUILD_BINARIESDIRECTORY%

BuildSensei.BuildWindowsUWP is this function:

 PlayerSettings.SplashScreen.showUnityLogo = false;

 string[] scenes = { "Assets/MyProject/Scenes/Login.unity", "Assets/MyProject/Scenes/Main.unity" };

 string outputDirectory = "C:/Users/PavanJakhu/source/repos/myproject/Builds/UWP/MyProject-2.3.1.0";
 if (Directory.Exists(outputDirectory))
 {
     Directory.Delete(outputDirectory, true);
 }
 if (!Directory.Exists(outputDirectory))
 {
     Directory.CreateDirectory(outputDirectory);
 }

 BuildPlayerOptions options = new BuildPlayerOptions()
 {
     scenes = scenes,
     locationPathName = outputDirectory,
     target = BuildTarget.WSAPlayer,
     targetGroup = BuildTargetGroup.WSA,
     options = BuildOptions.None
 };
 var result = BuildPipeline.BuildPlayer(options);

 Debug.Log("Build result: " + result.summary.result + "\nTotal time: " + result.summary.totalTime + "\nPlatform: " + result.summary.platform);

I then try to build the Visual Studio solution through MSBuild using this command:

 "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\msbuild.exe" "C:/Users/PavanJakhu/source/repos/myproject/Builds/UWP/MyProject-2.3.1.0\MyProject\MyProject.sln" /nologo /nr:false /p:AppxBundlePlatforms="x64" /p:AppxPackageDir="C:/Users/PavanJakhu/source/repos/myproject/Builds/UWP/MyProject-2.3.1.0\MyProject\AppxPackages\\" /p:UapAppxPackageBuildMode=SideloadOnly /p:AppxBundle=Never /p:platform="x64" /p:configuration="Master" /p:VisualStudioVersion="16.0"

I get the following two errors.

 error APPX0105: Cannot import the key file 'Sensei-Code-Signing-Cert.pfx'. The key file may be password protected. To correct this, try to import the certificate manually into the current user's personal certificate store.
 error APPX0107: The certificate specified is not valid for signing. For more information about valid certificates, see http://go.microsoft.com/fwlink/?LinkID=241478.

If I open the solution and check the certificate and click "Choose Certificate" I see this dialog. Choose Certificate dialog Which seems incorrect since all the values are just "(none)." If I click "Select a Certificate," a native Windows dialog appears with the certificates in my Personal Store and I select the certificate I got from Sectigo Limited then build using the above command. It builds the AppX file and I can install it on computers without being in Developer Mode.

I have tried installing and reinstalling the certificate to my Personal and Trusted People stores. I also have tried using a test certificate generated in Unity then changing the Publisher attribute in the Identity tag in the App Manifest file for the exported Visual Studio project, then signing the generated AppX file with the Sectigo Limited certificate using SignTool.exe but then I get the following error

 error 0x8007000B: The app manifest publisher name (CN=Arfront Technologies Inc.) must match the subject name of the signing certificate (CN=Arfront Technologies Inc., O=Arfront Technologies Inc., STREET=4141 Yonge Street, STREET=Suite 402, L=Toronto, S=Ontario, PostalCode=M2P2A8, C=CA).

I then tried to create another self-signed certificate with the same subject name as the Sectigo Limited certificate but that gave the same error. So I'm stuck now and don't really know how else to do this. How would I go about creating an UWP app that is signed so a person sideloading it doesn't need to be in Developer Mode?

capture.jpg (27.2 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by alexanderlarsen · Jan 25 at 12:06 PM

@PavanJ Did you ever figure out a solution to this?

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

109 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Unity Standalone CommandLineArgs 0 Answers

mcs.rsp File Not Working 1 Answer

Application.openURL crash in Universal App 0 Answers

In a UWP app, how do I distinguish between xbox one and windows? 0 Answers

Choose screen with Command line arguments 2 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges