locked
Visual Studio - Create App Package - Command Line

    Question

  • Is it possible to create an app package (for local use) with Visual Studio through a command  prompt?  I have tried using msbuild.exe and devenv.exe and have not found any commands that actually package the appx file.

    I am aware that I can use devenv.exe to build a solution through command prompt and then use makeappx.exe to create the file, but when you have multiple projects in a solution the content files don't get placed into the primary project bin output dir in the proper structure that the appxrecipe file states.  Simply calling makeappx on the output directory does not result in a valid file. The 'Create App Package' wizard seems to do it correctly though.

    I don't understand why MakeAppx.exe doesn't accept a parameter to pass in the appxrecipe file.  That would seem very logical.

    Thanks,

    Jason Grimme

    Friday, March 2, 2012 2:44 AM

All replies

  • Hi Jason,

    You can build an app package on the command line just by invoking build on the project using msbuild.exe (e.g. MSbuild.exe foo.csproj). Building the project on the command line automatically generates an app package as part of the build. Upon build completion, you should see a folder named AppPackages in the output location with the app package inside it. Note that the behavior is slightly different if you build in the VS IDE. Building the project in the IDE does not generate the app package. You have to invoke the "Create App Package" wizard to build an app package. 

    Makeappx.exe is a different tool that can be used to build an app package. However this tool is separate from Visual Studio and does not utilize the appxrecipe file states because that file is only used by the Visual Studio build process.  

    Thanks,
    Candy

    Friday, March 2, 2012 7:36 PM
  • Candy,

    Why does msbuild build an appx package, when building in visual studio doesn't?  Is there a way to avoid building the app package from msbuild?

    ...Stefan

    Saturday, May 26, 2012 6:55 PM
  • The reason for not building the appx package when building in visual studio is to optimize performance for F5. When you press F5 on the app in VS, VS deploys the app without requiring the appx package to be built to make the debugging experience fast. When you build a metro app on the command line, the output of the build is meaningless just by itself because you cannot run the app by double-clicking on the exe. An appx package is required in order to install and run the app so the appx package is produced by default when you build on the command line. What is the reason why you want to disable building the app package from command line? 
    Tuesday, May 29, 2012 9:21 PM
  • Well, I have a Metro application that I am creating where the same base application is used with different content.  I have my own desktop-based program that outputs the content, compiles the Metro application, then copies the Metro application into the new content folder and makes that whole content folder into an appx using makeappx.  So when I am building the Metro application I don't want to build the appx. I have discovered that if I get it to rebuild rather than publishing, which is the default, then it does what I want.
    However, at this stage I have been unable to discover how to get my application to deploy the newly built appx in the same way visual studio does, as you have described (http://social.msdn.microsoft.com/Forums/en-US/windowsgeneraldevelopmentissues/thread/a4d2fca1-4034-4cc7-a86a-6242ce1a8b16)

    ...Stefan

    Tuesday, May 29, 2012 9:49 PM
  • Unfortunately there isn't a supported way to skip building the appx package when building on the command line. To deploy the appx package, you can either use the .bat file (we have changed this to a .ps1 in the VS Release Candidate) located in the output location of the appx package.
    Thursday, May 31, 2012 9:26 PM
  • Thanks, I hope that it will be possible to avoid building appx package in future.

    Wednesday, June 6, 2012 10:12 PM
  • Hi Jason,

    You can build an app package on the command line just by invoking build on the project using msbuild.exe (e.g. MSbuild.exe foo.csproj). Building the project on the command line automatically generates an app package as part of the build. Upon build completion, you should see a folder named AppPackages in the output location with the app package inside it. Note that the behavior is slightly different if you build in the VS IDE. Building the project in the IDE does not generate the app package. You have to invoke the "Create App Package" wizard to build an app package. 

    Makeappx.exe is a different tool that can be used to build an app package. However this tool is separate from Visual Studio and does not utilize the appxrecipe file states because that file is only used by the Visual Studio build process.  

    Thanks,
    Candy

    After Enabled the Multilingual App Toolkit and use Msbuild.exe rebuild my project, and the created package is wrong  and missed its multilingual, it's just english only.

    I used makeappx.exe to unpack the app package file, and the result is different with the files in the output location. In the outputlocation, AppxManifest.xml and the .pri file is correct, but in .appx file, after unpacked, these two files is wrong.  

    What's happend when msbuild.exe create the package? Why the multilingual is missing? 

    Thanks.

    Thursday, May 23, 2013 5:53 AM