diff --git a/README.md b/README.md index 22f347e1..e1e6414b 100644 --- a/README.md +++ b/README.md @@ -39,19 +39,34 @@ Click on the individual commands to learn more. You can use WingetCreate to update your existing app manifest as part of your CI/CD pipeline. For reference, see the final task in this repo's [release Azure pipeline](https://github.com/microsoft/winget-create/blob/main/pipelines/azure-pipelines.release.yml). -Unfortunately, we can't use the msixbundle in a standard Azure Pipeline pool. Instead, use the standalone exe, the latest version of which can be found at https://aka.ms/wingetcreate/latest, and the latest preview version can be found at https://aka.ms/wingetcreate/preview, both of these require .NET to be installed on the build machine. +### Using the standalone exe: +The latest version of the standalone exe can be found at https://aka.ms/wingetcreate/latest, and the latest preview version can be found at https://aka.ms/wingetcreate/preview, both of these require [.NET 5.0](https://dotnet.microsoft.com/en-us/download/dotnet/5.0) to be installed on the build machine. -If .NET isn't already installed, you can use https://aka.ms/wingetcreate/latest/self-contained or https://aka.ms/wingetcreate/preview/self-contained, which has .NET built-in, but is a larger download. +> Make sure your build machine has the [Microsoft Visual C++ Redistributable for Visual Studio](https://support.microsoft.com/en-us/topic/the-latest-supported-visual-c-downloads-2647da03-1eea-4433-9aff-95f26a218cc0) already installed. Without this, the standalone WingetCreate exe will fail to execute and likely show a "DllNotFoundException" error. -> When using either the framework-dependent or self-contained exe, make sure your build machine has the [Microsoft Visual C++ Redistributable for Visual Studio](https://support.microsoft.com/en-us/topic/the-latest-supported-visual-c-downloads-2647da03-1eea-4433-9aff-95f26a218cc0) already installed. Without this, the standalone WingetCreate exe will fail to execute and likely show a "DllNotFoundException" error. - -Then simply add a new powershell task to download the exe, and run it to update your manifest. It's recommended to not hardcode your PAT in your script, but instead use a [secret pipeline variable](https://docs.microsoft.com/azure/devops/pipelines/process/variables?view=azure-devops&tabs=yaml%2Cbatch#secret-variables) +Then simply add a new powershell task to download the exe, and run it to update your manifest. It's recommended to not hardcode your PAT in your script, but instead to use a [secret pipeline variable](https://docs.microsoft.com/azure/devops/pipelines/process/variables?view=azure-devops&tabs=yaml%2Cbatch#secret-variables). - powershell: | iwr https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe .\wingetcreate.exe update -u $(packageUrls) -v $(manifestVersion) -t $(GITHUB_PAT) displayName: Update package manifest in the OWC +### Using the msixbundle: +Windows Server 2022 now supports App Execution Aliases, which means the alias `wingetcreate` can be used to run the tool after installing the msixbundle. The latest version of the msixbundle can be found at https://aka.ms/wingetcreate/latest/msixbundle. Similar to the standalone exe steps, download the msixbundle, add the package, and run `wingetcreate` to update your manifest. + +> Winget-Create has a dependency on the [C++ Runtime Desktop framework package](https://docs.microsoft.com/en-us/troubleshoot/developer/visualstudio/cpp/libraries/c-runtime-packages-desktop-bridge). Be sure to also download and install this package prior to installing wingetcreate as shown in the steps below. + + - powershell: | + # Download and install C++ Runtime framework package. + iwr https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx -OutFile $(vcLibsBundleFile) + Add-AppxPackage $(vcLibsBundleFile) + + # Download Winget-Create msixbundle, install, and execute update. + iwr https://aka.ms/wingetcreate/latest/msixbundle -OutFile $(appxBundleFile) + Add-AppxPackage $(appxBundleFile) + wingetcreate update Microsoft.WingetCreate -u $(packageUrl) -v $(manifestVersion) -t $(GITHUB_PAT) --submit + + The CLI also supports creating or updating manifests with multiple installer URLs. You can either create new manifests with multiple installer nodes using the [New Command](doc/new.md) or update existing manifests with multiple installer URLs using the [Update Command](doc/update.md). ## GitHub Personal Access Token Permissions diff --git a/pipelines/azure-pipelines.release.yml b/pipelines/azure-pipelines.release.yml index 5e5d2930..bf967cbb 100644 --- a/pipelines/azure-pipelines.release.yml +++ b/pipelines/azure-pipelines.release.yml @@ -44,9 +44,7 @@ jobs: version: "$(majorMinorVersion).$(buildVersion).0" appxBundleFile: "Microsoft.WindowsPackageManagerManifestCreator_$(version)_8wekyb3d8bbwe.msixbundle" appxBundlePath: '$(appxPackageDir)\$(appxBundleFile)' - exeDirSelfContained: '$(appxPackageDir)\selfcontained' exeDirFrameworkDependent: '$(appxPackageDir)\dependent' - exePathSelfContained: '$(exeDirSelfContained)\WingetCreateCLI\wingetcreate-self-contained.exe' exePathFrameworkDependent: '$(exeDirFrameworkDependent)\WingetCreateCLI\wingetcreate.exe' pool: vmImage: $(vmImageName) @@ -59,7 +57,6 @@ jobs: echo $(version) echo $(appxBundlePath) echo $(appxBundleFile) - echo $(exePathSelfContained) echo $(exePathFrameworkDependent) echo "##vso[task.setvariable variable=manifestVersion;isOutput=true]$(version)" echo "##vso[task.setvariable variable=appxBundleFile;isOutput=true]$(appxBundleFile)" @@ -122,15 +119,6 @@ jobs: projects: $(workingDirectory)/**/WingetCreateCLI.csproj arguments: "--configuration Release --runtime=win-x64 --output $(exeDirFrameworkDependent) -p:DebugType=None -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true --self-contained=false" - - task: DotNetCoreCLI@2 - displayName: Build standalone, self-contained exe - inputs: - command: publish - publishWebProjects: false - zipAfterPublish: false - projects: $(workingDirectory)/**/WingetCreateCLI.csproj - arguments: "--configuration Release --runtime=win-x64 --output $(exeDirSelfContained) -p:DebugType=None -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true --self-contained=true" - - task: MSBuild@1 displayName: Build Solution inputs: @@ -178,9 +166,7 @@ jobs: - powershell: | ren "$(exeDirFrameworkDependent)\WingetCreateCLI\WingetCreateCLI.exe" wingetcreate.exe - ren "$(exeDirSelfContained)\WingetCreateCLI\WingetCreateCLI.exe" wingetcreate-self-contained.exe (Get-FileHash -Algorithm SHA256 -Path $(exePathFrameworkDependent)).Hash > "$(exePathFrameworkDependent).txt" - (Get-FileHash -Algorithm SHA256 -Path $(exePathSelfContained)).Hash > "$(exePathSelfContained).txt" (Get-FileHash -Algorithm SHA256 -Path $(appxBundlePath)).Hash > "$(appxBundlePath).txt" displayName: "Create hash files" @@ -191,9 +177,7 @@ jobs: flattenFolders: true contents: | $(exePathFrameworkDependent) - $(exePathSelfContained) $(exePathFrameworkDependent).txt - $(exePathSelfContained).txt $(appxBundlePath) $(appxBundlePath).txt @@ -234,23 +218,22 @@ jobs: skipComponentGovernanceDetection: ${{ true }} manifestVersion: $[dependencies.Build.outputs['OutputVersionStep.manifestVersion']] appxBundleFile: $[dependencies.Build.outputs['OutputVersionStep.appxBundleFile']] + vcLibsBundleFile: "Microsoft.VCLibs.x64.14.00.Desktop.appx" packageUrl: "https://github.com/microsoft/winget-create/releases/download/v$(manifestVersion)/$(appxBundleFile)" steps: - checkout: none - powershell: | - # These are the steps you'd run in your CI/CD pipeline to update your OWC manifest using wingetcreate. - # The update command only supports a single installer URL, if you have multiple URLs you'll have to manually modify - # your manifests as described here https://github.com/microsoft/winget-create#using-windows-package-manager-manifest-creator-in-a-cicd-pipeline - - # https://aka.ms/wingetcreate/latest points to latest version of wingetcreate.exe - # https://aka.ms/wingetcreate/preview points to latest preview version of wingetcreate.exe - # requires .NET to be installed on the build machine to operate correctly, but is a smaller download - - # https://aka.ms/wingetcreate/latest/self-contained points to latest self-contained version of wingetcreate.exe - # https://aka.ms/wingetcreate/preview/self-contained points to latest self-contained preview version of wingetcreate.exe - # does not require .NET to be installed on the build machine to operate correctly, but is a larger download - - iwr https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe - .\wingetcreate.exe update Microsoft.WingetCreate -u $(packageUrl) -v $(manifestVersion) -t $(GITHUB_PAT) --submit + # These are the steps you would run in your CI/CD pipeline to update your OWC manifest using wingetcreate. + # More information about using wingetcreate in your CI/CD pipeline can be found here: + # https://github.com/microsoft/winget-create#using-windows-package-manager-manifest-creator-in-a-cicd-pipeline + + # Download and install C++ Runtime framework package. + iwr https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx -OutFile $(vcLibsBundleFile) + Add-AppxPackage $(vcLibsBundleFile) + + # Download, install, and execute update. + iwr https://aka.ms/wingetcreate/latest/msixbundle -OutFile $(appxBundleFile) + Add-AppxPackage $(appxBundleFile) + wingetcreate update Microsoft.WingetCreate -u $(packageUrl) -v $(manifestVersion) -t $(GITHUB_PAT) --submit displayName: Update package manifest in the OWC