Giter Club home page Giter Club logo

wsl-distrolauncher's Introduction

WSL Distro Launcher Reference Implementation

Introduction

This is the C++ reference implementation for a Windows Subsystem for Linux (WSL) distribution installer/launcher application. Every distro package must include a launcher app, which is responsible for completing installation & registration of your distro with WSL, and for launching new distro instances atop WSL.

Once you've built your distro launcher, packaged it along with the required art assets, manifest, and distro.tar.gz, and digitally signed the package, you will be able to sideload your distro on your own machine(s).

Goals

The goal of this project is to enable:

  • Linux distribution owners to package and submit an application that runs on top of WSL to the Microsoft Store
  • Developers to create custom Linux distributions that can be sideloaded onto their dev machine

Contents

This reference launcher provides the following functionality: (where launcher.exe is replaced by the distro-specific name)

  • launcher.exe

    • Launches the user's default shell in the user's home directory.
  • launcher.exe install [--root]

    • Install the distribution and do not launch the shell when complete.
      • --root: Do not create a user account and leave the default user set to root.
  • launcher.exe run <command line>

    • Run the provided command line in the current working directory. If no command line is provided, the default shell is launched.
    • Everything after run is passed to WslLaunchInteractive.
  • launcher.exe config [setting [value]]

    • Configure settings for this distribution.
    • Settings:
      • --default-user <username>: Sets the default user to . This must be an existing user.
  • launcher.exe help

    • Print usage information.

Launcher Outline

This is the basic flow of how the launcher code is set up.

  1. If the distribution is not registered with WSL, register it. Registration extracts the tar.gz file that is included in your distribution appx.
  2. Once the distro is successfully registered, any other pre-launch setup is performed in InstallDistribution(). This is where distro-specific setup can be performed. As an example, the reference implementation creates a user account and sets this user account as the default for the distro.
    • Note: The commands used to query and create user accounts in this reference implementation are Ubuntu-specific; change as necessary to match the needs of your distro.
  3. Once the distro is configured, parse any other command-line arguments. The details of these arguments are described above, in the Introduction.

Project Structure

The distro launcher is comprised of two Visual Studio projects - launcher and DistroLauncher-Appx. The launcher project builds the actual executable that is run when a user launches the app. The DistroLauncher-Appx builds the distro package with all the correctly scaled assets and other dependencies. Code changes will be built in the launcher project (under DistroLauncher/). Manifest changes are applied in the DistroLauncher-Appx project (under DistroLauncher-Appx/).

Getting Started

  1. Generate a test certificate:

    1. In Visual Studio, open DistroLauncher-Appx/MyDistro.appxmanifest
    2. Select the Packaging tab
    3. Select "Choose Certificate"
    4. Click the Configure Certificate drop down and select Create test certificate.
  2. Edit your distribution-specific information in DistributionInfo.h and DistributionInfo.cpp. NOTE: The DistributionInfo::Name variable must uniquely identify your distribution and cannot change from one version of your app to the next.

    Note: The examples for creating a user account and querying the UID are from an Ubuntu-based system, and may need to be modified to work appropriately on your distribution.

  3. Add an icon (.ico) and logo (.png) to the /images directory. The logo will be used in the Start Menu and the taskbar for your launcher, and the icon will appear on the Console window.

    Note: The icon must be named icon.ico.

  4. Pick the name you'd like to make this distro callable from the command line. For the rest of the README, I'll be using mydistro or mydistro.exe. This is the name of your executable and should be unique.

  5. Make sure to change the name of the project in the DistroLauncher-Appx/DistroLauncher-Appx.vcxproj file to the name of your executable we picked in step 4. By default, the lines should look like:

<PropertyGroup Label="Globals">
  ...
  <TargetName>mydistro</TargetName>
</PropertyGroup>

So, if I wanted to instead call my distro "TheBestDistroEver", I'd change this to:

<PropertyGroup Label="Globals">
  ...
  <TargetName>TheBestDistroEver</TargetName>
</PropertyGroup>

Note: DO NOT change the ProjectName of the DistroLauncher/DistroLauncher.vcxproj from the value launcher. Doing so will break the build, as the DistroLauncher-Appx project is looking for the output of this project as launcher.exe.

  1. Update MyDistro.appxmanifest. There are several properties that are in the manifest that will need to be updated with your specific values:

    1. Note the Identity Publisher value (by default, "CN=DistroOwner"). We'll need that for testing the application.
    2. Ensure <desktop:ExecutionAlias Alias="mydistro.exe" /> ends in ".exe". This is the command that will be used to launch your distro from the command line and should match the executable name we picked in step 4.
    3. Make sure each of the Executable values matches the executable name we picked in step 4.
  2. Copy your tar.gz containing your distro into the root of the project and rename it to install.tar.gz.

Setting up your Windows Environment

You will need a Windows environment to test that your app installs and works as expected. To set up a Windows environment for testing you can follow the steps from the Windows Dev Center.

Note: If you are using Hyper-V you can use the new VM gallery to easily spin up a Windows instance.

Also, to allow your locally built distro package to be manually side-loaded, ensure you've enabled Developer Mode in the Settings app (sideloading won't work without it).

Build and Test

To help building and testing the DistroLauncher project, we've included several scripts to automate some tasks. You can either choose to use these scripts from the command line, or work directly in Visual Studio, whatever your preference is.

Note: some sideloading/deployment steps don't work if you mix and match Visual Studio and the command line for development. If you run into errors while trying to deploy your app after already deploying it once, the easiest step is usually just to uninstall the previously sideloaded version and try again.

Building the Project (Command line):

To compile the project, you can simply type build in the root of the project to use MSBuild to build the solution. This is useful for verifying that your application compiles. It will also build an appx for you to sideload on your dev machine for testing.

Note: We recommend that you build your launcher from the "Developer Command Prompt for Visual Studio" which can be launched from the start menu. This command-prompt sets up several path and environment variables to make building easier and smoother.

build.bat assumes that MSBuild is installed at one of the following paths: %ProgramFiles*%\MSBuild\14.0\bin\msbuild.exe or %ProgramFiles*%\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\msbuild.exe or %ProgramFiles*%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\msbuild.exe.

If that's not the case, then you will need to modify that script.

Once you've completed the build, the packaged appx should be placed in a directory like WSL-DistroLauncher\x64\Release\DistroLauncher-Appx and should be named something like DistroLauncher-Appx_1.0.0.0_x64.appx. Simply double click that appx file to open the sideloading dialog.

You can also use the PowerShell cmdlet Add-AppxPackage to register your appx:

powershell Add-AppxPackage x64\Debug\DistroLauncher-Appx\DistroLauncher-Appx_1.0.0.0_x64_Debug.appx

Building Project (Visual Studio):

You can also easily build and deploy the distro launcher from Visual Studio. To sideload your appx on your machine for testing, all you need to do is right-click on the "Solution (DistroLauncher)" in the Solution Explorer and click "Deploy Solution". This should build the project and sideload it automatically for testing.

In order run your solution under the Visual Studio debugger, you will need to copy your install.tar.gz file into your output folder, for example: x64\Debug. NOTE: If you have registered your distribution by this method, you will need to manually unregister it via wslconfig.exe /unregister

Installing & Testing

You should now have a finished appx sideloaded on your machine for testing.

To install your distro package, double click on the signed appx and click "Install". Note that this only installs the appx on your system - it doesn't unzip the tar.gz or register the distro yet.

You should now find your distro in the Start menu, and you can launch your distro by clicking its Start menu tile or executing your distro from the command line by entering its name into a Cmd/PowerShell Console.

When you first run your newly installed distro, it is unpacked and registered with WSL. This can take a couple of minutes while all your distro files are unpacked and copied to your drive.

Once complete, you should see a Console window with your distro running inside it.

Publishing

If you are a distro vendor and want to publish your distro to the Windows store, you will need to complete some pre-requisite steps to ensure the quality and integrity of the WSL distro ecosystem, and to safeguard our users:

Publishing Pre-Requisites

  1. Sign up for an "Company" Windows Developer Account https://developer.microsoft.com/en-us/store/register.

    Note: This can take a week or more since you'll be required to confirm your organization's identity with an independent verification service via email and/or telephone.

  2. Follow the guides to publish your distro as a UWP app: https://docs.microsoft.com/en-us/windows/uwp/publish/
  3. [Optional] Reach out to the WSL team at [email protected] to introduce us to your distro!

Publishing Code changes

You'll also need to change a few small things in your project to prepare your distro for publishing to the Windows store

  1. In your appxmanifest, you will need to change the values of the Identity field to match your identity in your Windows Store account:
<Identity Name="1234YourCompanyName.YourAppName"
          Version="1.0.1.0"
          Publisher="CN=12345678-045C-ABCD-1234-ABCDEF987654"
          ProcessorArchitecture="x64" />

NOTE: Visual Studio can update this for you! You can do that by right-clicking on "DistroLauncher-Appx (Universal Windows)" in the solution explorer and clicking on "Store... Associate App with the Store..." and following the wizard.

  1. You will either need to run build rel from the command line to generate the Release version of your appx or use Visual Studio directly to upload your package to the store. You can do this by right-clicking on "DistroLauncher-Appx (Universal Windows)" in the solution explorer and clicking on "Store... Create App Packages..." and following the wizard.

Also, make sure to check out the Notes for uploading to the Store page on our wiki for more information.

Issues & Contact

Any bugs or problems discovered with the Launcher should be filed in this project's Issues list. The team will be notified and will respond to the reported issue within 3 (US) working days.

You may also reach out to our team alias at [email protected] for questions related to submitting your app to the Microsoft Store.

Contributing

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

wsl-distrolauncher's People

Contributors

a-23187 avatar bitcrazed avatar craigloewen-msft avatar hoverbear avatar imaandrew avatar ionicabizau avatar lcsondes avatar microsoft-github-policy-service[bot] avatar microsoftopensource avatar miniksa avatar msftgits avatar patrick330602 avatar prinsfrank avatar sundhaug92 avatar tara-raj avatar wsluser avatar zadjii-msft avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wsl-distrolauncher's Issues

StoreLogo is expected as 100x100 yet AssetsValidator demands 50x50

Uploading the .appx into the developer dashboard fails validation requesting store logo asset to be 50x50 png.

However, when sideloading / double clicking the self-signed appx, the image in use is clearly 100x100 png.

Building a valid package with 50x50 png logo, results in ugly sideloading. See image attached. Please update the store to accept 100x100 png StoreLogos, or please update the Sideloading app to use 50x50 png.

...Ideally it should be a square SVG anyway =)

sideloading-50x50

What Ubuntu rootfs to use?

I really want to build my own package for development. But i can't figure out what rootfs is used. Is the code to generate the correct rootfs somewhere? I tried using the ubuntu cloudimg rootfs's which are hosted on canonical.com but that doesn't work :(

Anyone have any idea?

README.md Getting Started: Packaging Tab cannot be found

Hi!

Using fresh, never opened VS2019 Community Edition installed within the last week.

Following step 1.ii and 1.iii here: https://github.com/microsoft/WSL-DistroLauncher#getting-started

When you open the MyDistro.appxmanifest it is unclear where the "Packaging" tab is.

image

Could this portion of the README.md receive some clarity?

It looks like I should be doing something like

New-SelfSignedCertificate -Type Custom -Subject "CN=Hoverbear, O=Hoverbear, C=CA" -KeyUsage DigitalSignature -FriendlyName "Hoverbear" -CertStoreLocation "Cert:\CurrentUser\My" -TextExtension @("2.5.29.37={text}1.3.6.1.5.5.7.3.3", "2.5.29.19={text}")

README.md Building Project with Visual Studio instructions incorrect

Hi!

In https://github.com/microsoft/WSL-DistroLauncher#building-project-visual-studio the step states:

You can also easily build and deploy the distro launcher from Visual Studio. To sideload your appx on your machine for testing, all you need to do is right-click on the "Solution (DistroLauncher)" in the Solution Explorer and click "Deploy Solution". This should build the project and sideload it automatically for testing.

In order run your solution under the Visual Studio debugger, you will need to copy your install.tar.gz file into your output folder, for example: x64\Debug. NOTE: If you have registered your distribution by this method, you will need to manually unregister it via wslconfig.exe /unregister

Right clicking on "Solution 'DistroLauncher'" (Not "Solution (Distrolauncher)") here you can find "Deploy Solution":

image

However clicking on this does not actually produce any results.

It seems that the user must select their arch and mode here then hit "Start":

image

However, if the user followed the Getting Started steps https://github.com/microsoft/WSL-DistroLauncher#getting-started they never changed or set OutputPath, so they see this error:

This results in errors still:

image

No combination or debug/release x86/ARM works.

Provide a generic distribution Lancher/installer with Windows.

The reality idea here has main fails.

  1. Linux distribution build servers not run Windows. So don't run MSVC compiler. The compilers had to choose between was llvm clang with windows support or mingw both you will find on Linux.

  2. there are hundreds of Linux Distributions you don't want each one installing there own exes if you can avoid it.

  3. security issues. WSL does not contain lets check if the tar.gz has a valid signature. Also you have not allowed that the Launcher really need to be able to go to a URL and check if the file the person is attempt to install is current and if it not current download a new tar.gz. WSL does not contain method to register distribution update command.

So really WSL core functions need added

  1. function for add under distribution name the pgp release key. This release key used to check tar.gz files if they are valid or not.
  2. function to register update commands and package status commands for a distribution.
  3. function to access and used registered update and package status commands.
  4. function to list all installed distributions. This will be useful latter.

WSL need the following command line commands.

  1. WSLKey [distribution] [release key] to add release keys
  2. WSLinstal -d [distribution name override optional] [distribution.tar.gz]
  3. WSLRun [distribution] [Linux command] This one can possible have a few options.
  4. WSLUninstall [distribution name] removes distribution including its release key.
  5. WSLList This is simple list installed distributions.
  6. WSLupdate [distribution]
    This would provide enough that generic installers like NSIS could be used.

WSL need graphical in the form of a program either intergrated with windows update or its own thing to check that all installs distributions are upto date and update as directed. Also a generic WSL graphical install could have list of approved distributions with URL where it will go and get current release key and current tar.gz

Finally the tar.gz of the distribution could have a WSL directory added contain all icons and a setup.ini file list everything that need to be executed before install and before uninstall This can also include registering in start menu.

At the end of this Linux Distributions should not need to be building any windows .exe files or dealing with the Microsoft Store also would have reduced security risk. The idea of each distribution roll their own installer is just asking for coding defects and security issues on Windows.

Launcher cannot retrieve full subsystem settings.

Greetings, all!

During development of the Ubuntu launcher we felt the need to retrieve more details from the subsystem configuration (besides the defaut configuration flags), details which are provided by the function WslGetConfiguration(), which is not exposed by WslApiLoader. Reference documentation about that function can be found here.

We implemented a simple addition to that class, which will be presented shortly as a pull request for your appreciation.

build succeeds but no appx is being created

repro:
clone the repro,
open the solution,
put install.tar.gz under WSL-DistroLauncher\x64
build the x64 configuration

expected:
build succeeds and appx file is created

observed:
build succeeds, but no appx file is being created, i searched for it, there are only directory with suffix appx:

PS D:\repos\WSL-DistroLauncher> gci -Recurse -Force -Include *appx -name
DistroLauncher-Appx
x64\Debug\DistroLauncher-Appx

Could not display system error message when non-English system locale.

image
Forced call Helpers::PrintErrorMessage(NO_ERROR);.

Wide character I/O function may not work when C locale.
Typically add call setlocale(LC_CTYPE, "") once resolves problem.

But Windows 10 version 1803 has "Use Unicode UTF-8 for worldwide language support" setting.
MSVC's C runtime doesn't support UTF-8 locale yet.
If will support both UTF-8 locale and non UTF-8 locale, I think _setmode(_fileno(stdout), _O_U8TEXT) instead of setlocale() may good.

MSVCRT now supports UTF-8 locale.

Error: 0x80070002 - Uninstalling without clean

This is detailed further here.

This is likely caused by uninstalling your distro's app without first calling mydistro clean. This is due to a bug in WSL that's being fixed currently (as of May 18, 2017).

Workaround

Just install you app again, and call mydistro clean. That should clean up your registry, and you should be able to install it again perfectly fine.

Trouble with getting started

Hi,
this must be a pretty dumb question from a newbie but I cannot figure out to complete 1st step of Getting started. More precisely I cannot find the "Packaging tab"?

I'm using Visual studio 2019 community Edition (in French :( on top of that).
Do I need some specific extensions?

Thanks for your help.
I really wish to build my own distrib.
Best

生产appx文件失败

     正在移除目录“x64\Debug\DistroLauncher-Appx_1.0.3.0_Bundle\”。
     正在创建目录“x64\Debug\DistroLauncher-Appx_1.0.3.0_Bundle”。
     创建硬链接以将“D:\wsl\WSL-DistroLauncher-master\x64\Debug\DistroLauncher-Appx\DistroLauncher-Appx_1.0.3.0_x64_Debug.msix”复制到“x64\Debug\DistroLauncher-Appx_1.0.3.0_
     Bundle\DistroLauncher-Appx_1.0.3.0_x64_Debug.msix”。
     Adding file 'x64\Debug\DistroLauncher-Appx_1.0.3.0_Bundle\DistroLauncher-Appx_1.0.3.0_x64_Debug.msix'
     C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x64\MakeAppx.exe bundle /d x64\Debug\DistroLauncher-Appx_1.0.3.0_Bundle\ /bv 1.0.3.0 /o /p D:\wsl\WS
     L-DistroLauncher-master\AppPackages\DistroLauncher-Appx\DistroLauncher-Appx_1.0.3.0_Debug_Test\DistroLauncher-Appx_1.0.3.0_x64_Debug.msixbundle
 4>MakeAppx : error : Error info: ?????? [D:\wsl\WSL-DistroLauncher-master\DistroLauncher-Appx\DistroLauncher-Appx.vcxproj]
 4>MakeAppx : error : Bundle creation failed. [D:\wsl\WSL-DistroLauncher-master\DistroLauncher-Appx\DistroLauncher-Appx.vcxproj]
 4>MakeAppx : error : 0x80080215 - ????????????????? appx ???? [D:\wsl\WSL-DistroLauncher-master\DistroLauncher-Appx\DistroLauncher-Appx.vcxproj]
 4>已完成生成项目“D:\wsl\WSL-DistroLauncher-master\DistroLauncher-Appx\DistroLauncher-Appx.vcxproj”(默认目标)的操作 - 失败。
 3>已完成生成项目“D:\wsl\WSL-DistroLauncher-master\DistroLauncher-Appx\DistroLauncher-Appx.vcxproj.metaproj”(默认目标)的操作 - 失败。
 1>已完成生成项目“D:\wsl\WSL-DistroLauncher-master\DistroLauncher.sln”(Build 个目标)的操作 - 失败。

生成失败。

   “D:\wsl\WSL-DistroLauncher-master\DistroLauncher.sln”(Build 目标) (1) ->
   “D:\wsl\WSL-DistroLauncher-master\DistroLauncher-Appx\DistroLauncher-Appx.vcxproj.metaproj”(默认目标) (3) ->
   “D:\wsl\WSL-DistroLauncher-master\DistroLauncher-Appx\DistroLauncher-Appx.vcxproj”(默认目标) (4) ->
   (PrepareForBuild 目标) ->
     D:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(452,5): warning MSB8028: The intermediate
    directory (x64\Debug\) contains files shared from another project (mydistro.vcxproj).  This can lead to incorrect clean and rebuild behavior. [D:\wsl\WSL-Dis
   troLauncher-master\DistroLauncher-Appx\DistroLauncher-Appx.vcxproj]


   “D:\wsl\WSL-DistroLauncher-master\DistroLauncher.sln”(Build 目标) (1) ->
   “D:\wsl\WSL-DistroLauncher-master\DistroLauncher-Appx\DistroLauncher-Appx.vcxproj.metaproj”(默认目标) (3) ->
   “D:\wsl\WSL-DistroLauncher-master\DistroLauncher-Appx\DistroLauncher-Appx.vcxproj”(默认目标) (4) ->
   (_ValidateAppxManifest 目标) ->
     MyDistro.appxmanifest(14,6): warning APPX0006: 此项目使用“runFullTrust”功能。应使用 Windows 应用程序打包项目来生成存储和旁加载程序包。有关详细信息,请参阅 https://go.microsoft.com/fwlink/?linkid=871
   803。 [D:\wsl\WSL-DistroLauncher-master\DistroLauncher-Appx\DistroLauncher-Appx.vcxproj]


   “D:\wsl\WSL-DistroLauncher-master\DistroLauncher.sln”(Build 目标) (1) ->
   “D:\wsl\WSL-DistroLauncher-master\DistroLauncher-Appx\DistroLauncher-Appx.vcxproj.metaproj”(默认目标) (3) ->
   “D:\wsl\WSL-DistroLauncher-master\DistroLauncher-Appx\DistroLauncher-Appx.vcxproj”(默认目标) (4) ->
   (_CreateBundle 目标) ->
     MakeAppx : error : Error info: ?????? [D:\wsl\WSL-DistroLauncher-master\DistroLauncher-Appx\DistroLauncher-Appx.vcxproj]
     MakeAppx : error : Bundle creation failed. [D:\wsl\WSL-DistroLauncher-master\DistroLauncher-Appx\DistroLauncher-Appx.vcxproj]
     MakeAppx : error : 0x80080215 - ????????????????? appx ???? [D:\wsl\WSL-DistroLauncher-master\DistroLauncher-Appx\DistroLauncher-Appx.vcxproj]

2 个警告
3 个错误

已用时间 00:00:22.53
C:\Users\d>

wslapi.h not found

Greetings Team,

Seems I'm missing a library package somewhere, but not finding much online about where to get this header file.

Severity Code Description Project File Line Suppression State Suppression State
Error C1083 Cannot open include file: 'wslapi.h': No such file or directory C:\Users\nandesu\source\repos\WSL-DistroLauncher\DistroLauncher\DistroLauncher.vcxproj C:\Users\nandesu\source\repos\WSL-DistroLauncher\DistroLauncher\stdafx.h 27

Any assistance is greatly appreciated.

'HCS_E_HYPERV_NOT_INSTALLED': undeclared identifier

Hello, everyone! Happy new year!

Current state of the master branch fails to compile with msbuild command line.
PR #101 introduced the HRESULT HCS_E_HYPERV_NOT_INSTALLED which seems to be defined in Windows 10 SDK, version 1809 (10.0.17763.0), a few releases behind the latest, but the launcher project file targets version 10.0.16299, thus resulting in the undeclared identifier compilation error.

The fix seems to be simple: upgrade the target SDK to a proper version. To which version of the SDK should we upgrade to?

Custom WSL Distro build error in VS - MSB6006"cmd.exe" exited with error code 1.

Hello Everyone,
I am totally new in building WSL custom distro, so sorry if I miss something trivial.
When I try to build the custom distro from VS2019 Enterprise by following instructions on GitHub, I am getting error during the build (attached screenshots).

What I did:

  • downloaded Ubuntu 1804.2019.521.0 from Store for Business portal and installed / initialized it on a template machine
  • installed / configured few things inside the "vanilla" distro and exported it with wsl --export command into a tar.gz file
    -copied the exported/customized tar.gz file into WSL-DistroLauncher-master\DistroLauncher-Appx folder
    -started the build in VS

Could you please advise what can be wrong?

Regards,
wslnoob

Output

Output_fromVS

build.bat Failing

I designed my launcher exactly as the instructions say, and run build.bat. Build.bat gets a Windows SmartScreen error, which I had to fix. When i got Build.bat to run, it went smoothly until this: "C:\Users\TrTha\Downloads\WSL-DistroLauncher-master\WSL-DistroLauncher-master
DistroLauncher.sln" (Build target) (1) ->
"C:\Users\Downloads\WSL-DistroLauncher-master\WSL-DistroLauncher-master
DistroLauncher-Appx\DistroLauncher-Appx.vcxproj.metaproj" (default target) (3)
->
"C:\Users\Downloads\WSL-DistroLauncher-master\WSL-DistroLauncher-master
DistroLauncher-Appx\DistroLauncher-Appx.vcxproj" (default target) (4) ->
(CustomBuild target) ->
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC
\VCTargets\Microsoft.CppCommon.targets(171,5): error MSB6006: "cmd.exe" exited
with code 1. [C:\Users\Downloads\WSL-DistroLauncher-master\WSL-DistroLa
uncher-master\DistroLauncher-Appx\DistroLauncher-Appx.vcxproj]

This is my entire run:
Microsoft (R) Build Engine version 15.7.179.6572 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

Build started 7/24/2018 8:30:41 PM.
1>Project "C:\Users\Downloads\WSL-DistroLauncher-master\WSL-DistroLauncher
-master\DistroLauncher.sln" on node 1 (Build target(s)).
1>ValidateSolutionConfiguration:
Building solution configuration "Debug|x64".
1>Project "C:\Users\Downloads\WSL-DistroLauncher-master\WSL-DistroLauncher
-master\DistroLauncher.sln" (1) is building "C:\Users\Downloads\WSL-Dist
roLauncher-master\WSL-DistroLauncher-master\DistroLauncher\DistroLauncher.vcxp
roj" (2) on node 1 (default targets).
2>InitializeBuildStatus:
Creating "x64\Debug\launcher.tlog\unsuccessfulbuild" because "AlwaysCreate"
was specified.
CustomBuild:
All outputs are up-to-date.
ClCompile:
All outputs are up-to-date.
All outputs are up-to-date.
ResourceCompile:
All outputs are up-to-date.
Link:
All outputs are up-to-date.
DistroLauncher.vcxproj -> C:\Users\Downloads\WSL-DistroLauncher-master
\WSL-DistroLauncher-master\x64\Debug\launcher.exe
FinalizeBuildStatus:
Deleting file "x64\Debug\launcher.tlog\unsuccessfulbuild".
Touching "x64\Debug\launcher.tlog\launcher.lastbuildstate".
2>Done Building Project "C:\Users\Downloads\WSL-DistroLauncher-master\WSL-
DistroLauncher-master\DistroLauncher\DistroLauncher.vcxproj" (default targets)
.
1>Project "C:\Users\Downloads\WSL-DistroLauncher-master\WSL-DistroLauncher
-master\DistroLauncher.sln" (1) is building "C:\Users\Downloads\WSL-Dist
roLauncher-master\WSL-DistroLauncher-master\DistroLauncher-Appx\DistroLauncher
-Appx.vcxproj.metaproj" (3) on node 1 (default targets).
3>Project "C:\Users\Downloads\WSL-DistroLauncher-master\WSL-DistroLauncher
-master\DistroLauncher-Appx\DistroLauncher-Appx.vcxproj.metaproj" (3) is build
ing "C:\Users\Downloads\WSL-DistroLauncher-master\WSL-DistroLauncher-mas
ter\DistroLauncher-Appx\DistroLauncher-Appx.vcxproj" (4) on node 1 (default ta
rgets).
4>InitializeBuildStatus:
Touching "x64\Debug\Ubuntu14.04.tlog\unsuccessfulbuild".
CustomBuild:
Copy C:\Users\Downloads\WSL-DistroLauncher-master\WSL-DistroLauncher-m
aster\x64\Debug\launcher.exe into C:\Users\Downloads\WSL-DistroLaunch
er-master\WSL-DistroLauncher-master\x64\Debug\Ubuntu14.04\ubuntu14.04.exe
The system cannot find the path specified.
0 file(s) copied.
4>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\V
CTargets\Microsoft.CppCommon.targets(171,5): error MSB6006: "cmd.exe" exited w
ith code 1. [C:\Users\Downloads\WSL-DistroLauncher-master\WSL-DistroLaun
cher-master\DistroLauncher-Appx\DistroLauncher-Appx.vcxproj]
4>Done Building Project "C:\Users\Downloads\WSL-DistroLauncher-master\WSL-
DistroLauncher-master\DistroLauncher-Appx\DistroLauncher-Appx.vcxproj" (defaul
t targets) -- FAILED.
3>Done Building Project "C:\Users\Downloads\WSL-DistroLauncher-master\WSL-
DistroLauncher-master\DistroLauncher-Appx\DistroLauncher-Appx.vcxproj.metaproj
" (default targets) -- FAILED.
1>Done Building Project "C:\Users\Downloads\WSL-DistroLauncher-master\WSL-
DistroLauncher-master\DistroLauncher.sln" (Build target(s)) -- FAILED.

Build FAILED.

   "C:\Users\\Downloads\WSL-DistroLauncher-master\WSL-DistroLauncher-master\
   DistroLauncher.sln" (Build target) (1) ->
   "C:\Users\\Downloads\WSL-DistroLauncher-master\WSL-DistroLauncher-master\
   DistroLauncher-Appx\DistroLauncher-Appx.vcxproj.metaproj" (default target) (3)
    ->
   "C:\Users\\Downloads\WSL-DistroLauncher-master\WSL-DistroLauncher-master\
   DistroLauncher-Appx\DistroLauncher-Appx.vcxproj" (default target) (4) ->
   (CustomBuild target) -> 
     C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC
   \VCTargets\Microsoft.CppCommon.targets(171,5): error MSB6006: "cmd.exe" exited
    with code 1. [C:\Users\\Downloads\WSL-DistroLauncher-master\WSL-DistroLa
   uncher-master\DistroLauncher-Appx\DistroLauncher-Appx.vcxproj]

0 Warning(s)
1 Error(s)

Time Elapsed 00:00:40.05

I have a certificate file, install.tar.gz of Ubuntu Base 14.04.5 (http://cdimage.ubuntu.com/ubuntu-base/releases/14.04/release/) amd64 and everything the guide tells me to do.

From what I understand, something went wrong on a build command.
Thank You.

Allow other Linux Destros to take place of bash

I am not sure if this issue needs to be opened here or at Microsoft/vscode.
But, it appears that currently, WSL prefers Ubuntu only to be it's primary WSL Bash terminal. (I already have Ubuntu , openSUSE Leap 42, Debian GNU/Linux and Kali Linux.

Here's a screenshot of for the same on VS Code:
capture

I think, the same follows for other code editors with integrated terminals. (See path for WSL in the above image).

Please do let me know, if this is a VS Code only problem, so that I will reference this issue there, or it's related to some other repository. Also, I am currently on Microsoft Windows Version 1709 (Fall Creators Update) with OS Build 16299.334.

Custom Distro CI/CD build using github workflow

Team this is more of question/requesting recommendation, might turn into a feature.

I am a SIG/Cloud member of AlmaLinux, looking to setup and automate build for AlmaLinux-WSL package. Is it possible to make use of github workflow to create WSL application package (appx). Steps or sample would greatly appreciated.

I understand AlmaLinux team has to contact WSL team [email protected] for initial setup AlmaLinux distro.

README.md Getting Started: VS2019 can't open DistroLauncher-Appx/DistroLauncher-Appx.vcxproj

Hi!

In step 5 of https://github.com/microsoft/WSL-DistroLauncher#getting-started the instruction is:

Make sure to change the name of the project in the DistroLauncher-Appx/DistroLauncher-Appx.vcxproj file to the name of your executable we picked in step 4. By default, the lines should look like:

In this case the user has been instructed to open the project in Visual Studio already (by opening the .sln), so the user is unable to find the vcx.proj in the solution explorer:

image

They then might try to open the file directly via "File -> Open" and selecting the correct file. They'd see this error:

image

A user unfamiliar with VS2019 (which sounds like a common thing for folks who want to build WSL distros) may not know they need to change to "Folder View" in the "Solution Explorer" under the "White Square in Front of Folder with Arrows implying they rotate or something" icon.

Please clarify DistroName in "Getting Started" documentation

In the "Getting Started" Section the Distro name is note 100% clear to me what you mean. You write:

  1. First of all, pick a Name for your distro. WSL will use this as a key to identify this particular version of your distro - so please try to make it unique! This name should not change from one version of your app to the next.
    Set this name in MyLinuxDistroLauncher::Initialize, by setting this->_MyName. By default, the value is "MyDistro.1.0"

Either my DistroName is e.g. "Debian GNU/Linux" without a version, or it would be "Debian GNU/Linux 9 (Codename Stretch)". Your example includes a version in the DistroName which you say above shall not change.

Stuck adding my distro to WSL, don't know how to debug or where to find logs

I'm trying to get my custom linux distro to run in WSL. I'm able to register it but cannot run anything in it. From what I've learned from experimentation and looking at some launcher code, when you call WslRegisterDistribution, WSL seems to determines the "distro folder" based on the path where the running executable is stored, then takes the rootfs file given as the second argument and extracts it to the folder. It then makes some registry entries in:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss

with the Name/BasePath etc. I can verify my distro is registerd with wslconfig /l (looks like my Windows 10 isn't the most up-to-date) and I can see it in the registry.

When I try to launch my distro, either by invokingWslLaunchInteractive from an executable or by running wsl -d mydistro run, it just exits immediately with no message as to what went wrong. The WslLaunchInteractive function returns 0 (success) and sets the exit code to -1. I've tried running different binaries from my distro but still see the same result. At this point I'm not sure what to do as I don't have access to the WslLaunchInteractive source code and I don't know where to find error logs. Are there error logs somewhere? Is there a way to enable more logging or triage what's going wrong? Maybe my distro is missing some file in it, is there documentation on what WSL requires from a distro's rootfs that I could be missing? (by the way, I tried adding /etc/wslpath as I noticed that Alpine seems to have this file and set it to my distro's /sbin/init process, and also, Alpine and Ubuntu 16.04 work just fine). Any help is appreciated, thanks!

My distro source is here: https://github.com/marler8997/maros
I've written some wsl tools to help me here: https://github.com/marler8997/wsl-launcher

Set Downstream information in seperate header

If this is seen as base for a wsl distro, wouldn't it be better to use a seperate header for the distro information and a shel script for the install distro part to be used?
I think this would avoid editing upstream code and make integration easier.

README confusion

Step 5 under "Getting Started" says:

Make sure to change the name of the project in the DistroLauncher-Appx/DistroLauncher-Appx.vcxproj file to the name of your executable we picked in step 4. By default, the lines should look like:
<PropertyGroup Label="Globals">
  ...
  <ProjectName>mydistro</ProjectName>
</PropertyGroup>
So, if I wanted to instead call my distro "TheBestDistroEver", I'd change this to:
<PropertyGroup Label="Globals">
  ...
  <ProjectName>TheBestDistroEver</ProjectName>
</PropertyGroup>
Note: DO NOT change the ProjectName of the DistroLauncher/DistroLauncher.vcxproj from the value launcher. Doing so will break the build, as the DistroLauncher-Appx project is looking for the output of this project as launcher.exe.

Those above instructions (a) say to change ProjectName then (b) say not to change it.

Also, the file as provided in the git repo doesn't mention "launcher" in either TargetName or ProjectName, so it isn't clear what the warning refers to.

Under "Build and Test", the instructions say:

To compile the project, you can simply type build in the root of the project to use MSBuild to build the solution.

However, when I do that, I get this error:

C:\Users\phili\Documents\GitHub projects\WSL-DistroLauncher>build.bat
Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

MSBUILD : error MSB1008: Only one project can be specified.
Switch: projects\WSL-DistroLauncher\\DistroLauncher.sln

For switch syntax, type "MSBuild /help"

Under "Building Project (Visual Studio)", the documentation says:

In order run your solution under the Visual Studio debugger, you will need to copy your install.tar.gz file into your output folder, for example: x64\Debug.

That isn't correct - it needs to be under the platform type, not the output folder, i.e. "x64".

Automatically enable WSL on first install

After reading some of the comments received for the Debian store app, I think it would benefit our users greatly to not have to follow the manual enablement mechanism for fist users of wsl.

Could we integrate a check in the launcher to see if the wsl optional windows feature has been enabled already, and if not, to show a user friendly pop-up?

This would lower the barrier for non-technical users significantly.

Creating a Redhat Distro?

I realize that this not necessarily an "issue", but the information seems impossible to find.

I was on the Microsoft site and it looks like someone suggested creating a WSL forum, but it was decided to keep the discussion at Github... so I figured that I would try asking here...

Thanks in advance for your help (and possibly patience) :)

Unattended Install

I want to be able to do an unattended install as if from the Microsoft Store. There is install --root, which you document prominently:

ubuntu1804.exe install --root

and this is what is used by

https://github.com/microsoft/windows-dev-box-setup-scripts/blob/a0d80679847fc668bdc1706ae29b45da7a65772b/scripts/WSL.ps1#L10

but that team knows they should be installing with a regular user, but declined to explain fully how to actually to implement https://github.com/microsoft/windows-dev-box-setup-scripts/blob/d488050/README.md#how-to-run-the-scripts

If you are using WSL there's a followup step we recommend after running the setup script. When the script finishes you will only have a root user with a blank password. You should manually create a non-root user via $ sudo adduser [USERNAME] sudo with a non-blank password. Use this user going forward. For more info on WSL please refer to the documentation.

From microsoft/WSL#3369 I learned that I make an almost fully-automatic user account by:

Ubuntu1804 install --root
Ubuntu1804 run apt update
Ubuntu1804 run apt upgrade -y

Ubuntu1804 run adduser -m user
Ubuntu1804 run 'echo user:password | chpasswd'
Ubuntu1804 run 'chsh -s /bin/bash user'

# change default user to 'user'
reg.exe query HKCU\Software\Microsoft\Windows\CurrentVersion\Lxss\ # to get the GUID of the container
reg.exe add 'HKCU\Software\Microsoft\Windows\CurrentVersion\Lxss\{1422a095-2e43-4bf8-8108-d209cabe2a07}' /v DefaultUid /t REG_DWORD /d 1000 /f

But this is really fragile:

  1. It requires parsing out a GUID from the registry; and even if I did script that, it would probably break down as soon as a second distro was installed
  2. It just guesses that 'user' == UID 1000

I wish this section of code was just slightly different:

// Create a user account.
if (createUser) {
Helpers::PrintMessage(MSG_CREATE_USER_PROMPT);
std::wstring userName;
do {
userName = Helpers::GetUserInput(MSG_ENTER_USERNAME, 32);
} while (!DistributionInfo::CreateUser(userName));
// Set this user account as the default.
hr = SetDefaultUser(userName);
if (FAILED(hr)) {
return hr;
}
}

or maybe this one:

std::wstring commandLine = L"/usr/sbin/adduser --quiet --gecos '' ";
commandLine += userName;
HRESULT hr = g_wslApi.WslLaunchInteractive(commandLine.c_str(), true, &exitCode);

Could there be a --unattended or --default-user flag that does a clean unattended install? Or, a wsl set-user that would let me change the default user after initially installing with root?

MakeAppx : error : 0x80080215

I can deploy the solution, and my ditro runs well in my computer.
When I want to publish it, I have done those steps:

  1. I register a company account.
  2. I have filled the info in MyDitro.appxmanifest, and change the "mydistro" to "openEuler".
  3. I right click the "DistroLauncher-Appx" in the solution window, then "publiss", then "Create App packages ..."
  4. I finish filling info, then click "create", then a lot of errors and warning show up:
    Here is my full build output:
    Hoping someone can help me.
    Many thanks to you !

Build started...
1>------ Build started: Project: launcher, Configuration: Release x64 ------
1>Compiling Messages...
1>MC: Compiling D:\AQA\WorkShop\WSL\WSL-DistroLauncher\DistroLauncher\messages.mc
1>D:\IDE\VisualStuidio2019\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(240,5): warning MSB8065: Custom build for item "messages.mc" succeeded, but specified output "d:\aqa\workshop\wsl\wsl-distrolauncher\distrolauncher\msg0409.bin" has not been created. This may cause incremental build to work incorrectly.
1>stdafx.cpp
1>DistributionInfo.cpp
1>DistroLauncher.cpp
1>Helpers.cpp
1>WslApiLoader.cpp
1>LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/LTCG' specification
1>Generating code
1>0 of 210 functions ( 0.0%) were compiled, the rest were copied from previous compilation.
1> 0 functions were new in current compilation
1> 0 functions had inline decision re-evaluated but remain unchanged
1>Finished generating code
1>DistroLauncher.vcxproj -> D:\AQA\WorkShop\WSL\WSL-DistroLauncher\x64\Release\launcher.exe
1>Done building project "DistroLauncher.vcxproj".
2>------ Build started: Project: DistroLauncher-Appx, Configuration: Release x64 ------
2>Copy D:\AQA\WorkShop\WSL\WSL-DistroLauncher\x64\Release\launcher.exe into D:\AQA\WorkShop\WSL\WSL-DistroLauncher\x64\Release\DistroLauncher-Appx\openEuler.exe
2>已复制 1 个文件。
2>D:\IDE\VisualStuidio2019\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(240,5): warning MSB8064: Custom build for item "openEuler" succeeded, but specified dependency "d:\aqa\workshop\wsl\wsl-distrolauncher\distrolauncher-appx\openeuler" does not exist. This may cause incremental build to work incorrectly.
2>D:\IDE\VisualStuidio2019\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(240,5): warning MSB8065: Custom build for item "openEuler" succeeded, but specified output "d:\aqa\workshop\wsl\wsl-distrolauncher\distrolauncher-appx\openeuler.exe" has not been created. This may cause incremental build to work incorrectly.
2>MyDistro.appxmanifest(14,6): warning APPX0006: This project uses the 'runFullTrust' capability. You should use the Windows Application Packaging Project to produce the store and sideload packages. See https://go.microsoft.com/fwlink/?linkid=871803 for more information.
2>DistroLauncher-Appx -> D:\AQA\WorkShop\WSL\WSL-DistroLauncher\x64\Release\DistroLauncher-Appx\DistroLauncher-Appx_1.0.3.0_x64.msix
2>DistroLauncher-Appx -> D:\AQA\WorkShop\WSL\WSL-DistroLauncher\x64\Release\DistroLauncher-Appx\DistroLauncher-Appx_1.0.3.0_scale-100.msix
2>DistroLauncher-Appx -> D:\AQA\WorkShop\WSL\WSL-DistroLauncher\x64\Release\DistroLauncher-Appx\DistroLauncher-Appx_1.0.3.0_scale-125.msix
2>DistroLauncher-Appx -> D:\AQA\WorkShop\WSL\WSL-DistroLauncher\x64\Release\DistroLauncher-Appx\DistroLauncher-Appx_1.0.3.0_scale-150.msix
2>DistroLauncher-Appx -> D:\AQA\WorkShop\WSL\WSL-DistroLauncher\x64\Release\DistroLauncher-Appx\DistroLauncher-Appx_1.0.3.0_scale-400.msix
2>DistroLauncher-Appx -> D:\AQA\WorkShop\WSL\WSL-DistroLauncher\x64\Release\DistroLauncher-Appx\Upload\DistroLauncher-Appx_1.0.3.0_scale-100.msix
2>DistroLauncher-Appx -> D:\AQA\WorkShop\WSL\WSL-DistroLauncher\x64\Release\DistroLauncher-Appx\Upload\DistroLauncher-Appx_1.0.3.0_scale-125.msix
2>DistroLauncher-Appx -> D:\AQA\WorkShop\WSL\WSL-DistroLauncher\x64\Release\DistroLauncher-Appx\Upload\DistroLauncher-Appx_1.0.3.0_scale-150.msix
2>DistroLauncher-Appx -> D:\AQA\WorkShop\WSL\WSL-DistroLauncher\x64\Release\DistroLauncher-Appx\Upload\DistroLauncher-Appx_1.0.3.0_scale-400.msix
2>MakeAppx : error : Error info: ??????
2>MakeAppx : error : Bundle creation failed.
2>MakeAppx : error : 0x80080215 - ????????????????? appx ????
2>Done building project "DistroLauncher-Appx.vcxproj" -- FAILED.
========== Build: 1 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Package: 0 succeeded, 1 failed ===========
========== App Bundle: 0 succeeded, 1 failed ===========

Generate on Linux

Provide instructions to allow to generate the distro .tar.gz file from a Linux host machine.

WSL installer claims success even on failure

MSFT:12254696

  1. Install distro (sideload or store, whatever)
  2. Register distro.
  3. Delete Distro's registration from lxss key (Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss)
  4. Launch distro

Installing, this may take a few minutes...
Installation successful!
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: foo
Error: 0x80040302
Press any key to continue...

error APPX0107: The certificate specified is not valid for signing

There once was a pkg.bat that handled the creation of the signing key. I can't find anything about cert generation in the in README.

Output of build:

       "C:\Users\wsl\Desktop\WSL-DistroLauncher\DistroLauncher.sln" (Build target) (1) ->
       "C:\Users\wsl\Desktop\WSL-DistroLauncher\DistroLauncher-Appx\DistroLauncher-Appx.vcxproj.metaproj" (default targ
       et) (3) ->
       "C:\Users\wsl\Desktop\WSL-DistroLauncher\DistroLauncher-Appx\DistroLauncher-Appx.vcxproj" (default target) (4) -
       >
       (_CreateMainPackage target) ->
         C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Microsoft\VisualStudio\v15.0\AppxPackage
       \Microsoft.AppXPackage.Targets(3786,5): error APPX0104: Certificate file 'DistroLauncher-Appx_TemporaryKey.pfx'
       not found. [C:\Users\wsl\Desktop\WSL-DistroLauncher\DistroLauncher-Appx\DistroLauncher-Appx.vcxproj]
         C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Microsoft\VisualStudio\v15.0\AppxPackage
       \Microsoft.AppXPackage.Targets(3786,5): error APPX0107: The certificate specified is not valid for signing. For
       more information about valid certificates, see http://go.microsoft.com/fwlink/?LinkID=241478. [C:\Users\wsl\Desk
       top\WSL-DistroLauncher\DistroLauncher-Appx\DistroLauncher-Appx.vcxproj]

This is just after cloning the repo and putting in an install.tar.gz, without changing any of the MyDistro placeholders.

Bad error or bug build - install.tar.gz

I don't understend if this is a bug or bad build ?
I just use build.bat and I gat this error :

     4>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Mi
       crosoft\VisualStudio\v15.0\AppxPackage\Microsoft.AppXPackage.Targets(226
       9,5): error APPX0702: Payload file 'c:\WSL-DistroLauncher-master\install
       .tar.gz' does not exist. [c:\WSL-DistroLauncher-master\DistroLauncher-Ap
       px\DistroLauncher-Appx.vcxproj]

also the PS

PS c:\WSL-DistroLauncher-master\x64\Debug\DistroLauncher-Appx> Enable-WindowsOpt
ionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Enable-WindowsOptionalFeature : The requested operation requires elevation.
At line:1 char:1
+ Enable-WindowsOptionalFeature -Online -FeatureName
Microsoft-Windows-Subsystem-L ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Enable-WindowsOptionalFeature
   ], COMException
    + FullyQualifiedErrorId : Microsoft.Dism.Commands.EnableWindowsOptionalFea
   tureCommand

Building distro-launcher failing

I am using git clone https://github.com/microsoft/WSL-DistroLauncher.git and then run build.bat from a Visual 2017 command prompt. I am seeing the following errors. I have VS2017 Professional installed in my platform. Please can you tell me what I am doing wrong?

Thank you
Mousumi

build.bat
Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

Build started 2/10/2022 11:20:02 AM.
1>Project "c:\Users\mmh\WSL-DistroLauncher\DistroLauncher.sln" on node 1 (Build target(s)).
1>ValidateSolutionConfiguration:
Building solution configuration "Debug|x64".
1>Project "c:\Users\mmh\WSL-DistroLauncher\DistroLauncher.sln" (1) is building "c:\Users\mmh\WSL-DistroLauncher\Di
stroLauncher\DistroLauncher.vcxproj" (2) on node 1 (default targets).
2>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.Cpp.Platform
.targets(67,5): error MSB8020: The build tools for v142 (Platform Toolset = 'v142') cannot be found. To build us
ing the v142 build tools, please install v142 build tools. Alternatively, you may upgrade to the current Visual
Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution".
[c:\Users\mmh\WSL-DistroLauncher\DistroLauncher\DistroLauncher.vcxproj]
2>Done Building Project "c:\Users\mmh\WSL-DistroLauncher\DistroLauncher\DistroLauncher.vcxproj" (default targets)
-- FAILED.
1>Done Building Project "c:\Users\mmh\WSL-DistroLauncher\DistroLauncher.sln" (Build target(s)) -- FAILED.

Build FAILED.

   "c:\Users\mmh\WSL-DistroLauncher\DistroLauncher.sln" (Build target) (1) ->
   "c:\Users\mmh\WSL-DistroLauncher\DistroLauncher\DistroLauncher.vcxproj" (default target) (2) ->
   (PlatformPrepareForBuild target) ->
     C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.Cpp.Platfo
   rm.targets(67,5): error MSB8020: The build tools for v142 (Platform Toolset = 'v142') cannot be found. To build
   using the v142 build tools, please install v142 build tools.  Alternatively, you may upgrade to the current Visu
   al Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution
   ". [c:\Users\mmh\WSL-DistroLauncher\DistroLauncher\DistroLauncher.vcxproj]

0 Warning(s)
1 Error(s)

build.bat not generating appx

I'm very likely doing something wrong but I'm doing the build with msbuild via the build.bat script and where the instructions expect there to be a DistroLauncher-Appx_1.0.0.0_x64.appx type file I am not seeing one.

The build did not run into any errors and I do have a distname.exe file that was generated but without the appx I'm not sure what to do next.

WSL Launcher tries to run on Win10S

WSL can be enabled and distros installed on Windows 10S. However, distros cannot RUN on Win10S.

When one tries to run a distro, the following error is returned:
image

Error code 0x80073d07 is "ERROR_SYSTEM_NEEDS_REMEDIATION", which is meaningless to the user and prescribes unnecessary steps ("An error in a system binary was detected. Try refreshing the PC to fix the problem. ").

It'd be great if the user was presented with a more meaningful, descriptive, actionable error message.

install.tar.gz location is wrongly documented

repro:
clone the repro,
open the solution,
build the x64 configuration

expected:
build succeeds

observed:
build fails with:
2>\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(4651,5): error MSB3030: Could not copy the file "D:\repos\WSL-DistroLauncher\x64\install.tar.gz" because it was not found.

Notes:
The file install.tar.gz is requested to be under the WSL-DistroLauncher\x64
The readme.md tells to put it into the root of the project, i.e. /WSL-DistroLauncher/

Publishing to store

How do I get the necessary rights to publish a WSL app?
If I upload it, I just get the following Error message:

Package acceptance validation error: You don't have permissions to specify the following namespaces in the appx manifest file of the package DistroLauncher-Appx_1.0.1.0_x64.appx: restricted namespace: http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities

If I follow the link, I get

The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

Can you please include necessary steps on the Wiki Page "Notes for uploading to the Store"?
Also a note that registration to "Desktop Bridge" is required would have been nice.
Link: https://developer.microsoft.com/en-us/windows/projects/campaigns/desktop-bridge

Package acceptance validation error: Your developer account doesn’t have permission to submit apps converted with the Desktop Bridge at this time. https://aka.ms/desktopbridgeforwindowsstore

Package.StoreAssociation.xml can't be generated

Hi,
When I tried to build the project using build.bat, I got the error:
Could not find file ... DistroLauncher-Appx\Package.StoreAssociation.xml.

I tried to create one by selecting Store > Associate App with the Store .. but then it gave me this error:

"Unable to associate your App with the Window Store because the app manifest is invalid. Correct the errors in the app manifest.".

I am running Window 10, Visual Studio P. 2017 - 15.9.3
Please help . Thank you

Consider adding $WINHOME env-var

User has a good ask: Could WSL distro's come preconfigured with the $WINHOME environment variable set to the current users' Windows Home folder (e.g. /mnt/c/users/rich).

Consider for future releases.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.