-
Notifications
You must be signed in to change notification settings - Fork 1.5k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build winget in a container #669
Comments
We will take a look at this when we return from holiday. |
Here is my current config, which is almost certainly a superset of what is needed: {
"version": "1.0",
"components": [
"Microsoft.VisualStudio.Component.CoreEditor",
"Microsoft.VisualStudio.Workload.CoreEditor",
"Microsoft.NetCore.Component.Runtime.5.0",
"Microsoft.NetCore.Component.Runtime.3.1",
"Microsoft.NetCore.Component.SDK",
"Microsoft.VisualStudio.Component.NuGet",
"Microsoft.Net.Component.4.6.1.TargetingPack",
"Microsoft.VisualStudio.Component.Roslyn.Compiler",
"Microsoft.VisualStudio.Component.Roslyn.LanguageServices",
"Microsoft.VisualStudio.Component.FSharp",
"Microsoft.ComponentGroup.ClickOnce.Publish",
"Microsoft.NetCore.Component.DevelopmentTools",
"Microsoft.VisualStudio.Component.FSharp.WebTemplates",
"Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions",
"Microsoft.VisualStudio.Component.DockerTools",
"Microsoft.NetCore.Component.Web",
"Microsoft.Net.Component.4.8.SDK",
"Microsoft.Net.Component.4.7.2.TargetingPack",
"Microsoft.Net.ComponentGroup.DevelopmentPrerequisites",
"Microsoft.VisualStudio.Component.TypeScript.4.0",
"Microsoft.VisualStudio.Component.JavaScript.TypeScript",
"Microsoft.VisualStudio.Component.JavaScript.Diagnostics",
"Microsoft.Component.MSBuild",
"Microsoft.VisualStudio.Component.TextTemplating",
"Component.Microsoft.VisualStudio.RazorExtension",
"Microsoft.VisualStudio.Component.IISExpress",
"Microsoft.VisualStudio.Component.SQL.ADAL",
"Microsoft.VisualStudio.Component.SQL.LocalDB.Runtime",
"Microsoft.VisualStudio.Component.Common.Azure.Tools",
"Microsoft.VisualStudio.Component.SQL.CLR",
"Microsoft.VisualStudio.Component.MSODBC.SQL",
"Microsoft.VisualStudio.Component.MSSQL.CMDLnUtils",
"Microsoft.VisualStudio.Component.ManagedDesktop.Core",
"Microsoft.Net.Component.4.5.2.TargetingPack",
"Microsoft.Net.Component.4.5.TargetingPack",
"Microsoft.VisualStudio.Component.SQL.SSDT",
"Microsoft.VisualStudio.Component.SQL.DataSources",
"Component.Microsoft.Web.LibraryManager",
"Microsoft.VisualStudio.ComponentGroup.Web",
"Microsoft.VisualStudio.Component.Web",
"Microsoft.VisualStudio.Component.IntelliCode",
"Microsoft.Net.Component.4.TargetingPack",
"Microsoft.Net.Component.4.5.1.TargetingPack",
"Microsoft.Net.Component.4.6.TargetingPack",
"Microsoft.Net.ComponentGroup.TargetingPacks.Common",
"Microsoft.Net.Core.Component.SDK.2.1",
"Component.Microsoft.VisualStudio.Web.AzureFunctions",
"Microsoft.VisualStudio.ComponentGroup.AzureFunctions",
"Microsoft.VisualStudio.Component.Azure.Compute.Emulator",
"Microsoft.VisualStudio.Component.Azure.Storage.Emulator",
"Microsoft.VisualStudio.Component.Azure.ClientLibs",
"Microsoft.VisualStudio.Component.Azure.AuthoringTools",
"Microsoft.VisualStudio.Component.CloudExplorer",
"Microsoft.VisualStudio.Component.Debugger.TimeTravel",
"Microsoft.VisualStudio.Component.Debugger.Snapshot",
"Microsoft.VisualStudio.Component.IntelliTrace.FrontEnd",
"Microsoft.VisualStudio.Component.DiagnosticTools",
"Microsoft.VisualStudio.Component.EntityFramework",
"Microsoft.VisualStudio.Component.LiveUnitTesting",
"Microsoft.VisualStudio.Component.AspNet45",
"Microsoft.VisualStudio.Component.AppInsights.Tools",
"Microsoft.VisualStudio.Component.WebDeploy",
"Microsoft.VisualStudio.Component.Debugger.JustInTime",
"Microsoft.VisualStudio.Component.Wcf.Tooling",
"Microsoft.VisualStudio.Component.ClassDesigner",
"Microsoft.VisualStudio.Component.GraphDocument",
"Microsoft.VisualStudio.Component.CodeMap",
"Microsoft.VisualStudio.ComponentGroup.Azure.Prerequisites",
"Microsoft.VisualStudio.Component.Azure.Waverton.BuildTools",
"Microsoft.VisualStudio.Component.Azure.Waverton",
"Microsoft.Component.Azure.DataLake.Tools",
"Microsoft.VisualStudio.Component.Azure.Kubernetes.Tools",
"Microsoft.VisualStudio.Component.Azure.ResourceManager.Tools",
"Microsoft.VisualStudio.ComponentGroup.Azure.ResourceManager.Tools",
"Microsoft.VisualStudio.ComponentGroup.Azure.CloudServices",
"Microsoft.VisualStudio.Component.Azure.ServiceFabric.Tools",
"Microsoft.VisualStudio.Component.Azure.Powershell",
"Microsoft.VisualStudio.Workload.Azure",
"Microsoft.VisualStudio.Component.VC.CoreIde",
"Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
"Microsoft.VisualStudio.Component.Graphics.Tools",
"Microsoft.VisualStudio.Component.VC.DiagnosticTools",
"Microsoft.VisualStudio.Component.Windows10SDK.18362",
"Microsoft.VisualStudio.Component.ManagedDesktop.Prerequisites",
"Microsoft.ComponentGroup.Blend",
"Microsoft.VisualStudio.Component.DotNetModelBuilder",
"Microsoft.VisualStudio.Component.FSharp.Desktop",
"Microsoft.VisualStudio.ComponentGroup.MSIX.Packaging",
"Microsoft.VisualStudio.Workload.ManagedDesktop",
"Microsoft.VisualStudio.Component.VC.Redist.14.Latest",
"Microsoft.VisualStudio.ComponentGroup.ArchitectureTools.Native",
"Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core",
"Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions.CMake",
"Microsoft.VisualStudio.Component.VC.CMake.Project",
"Microsoft.VisualStudio.Component.VC.ATL",
"Microsoft.VisualStudio.Component.VC.TestAdapterForBoostTest",
"Microsoft.VisualStudio.Component.VC.TestAdapterForGoogleTest",
"Microsoft.VisualStudio.Component.VC.ASAN",
"Microsoft.VisualStudio.Component.VC.Llvm.ClangToolset",
"Microsoft.VisualStudio.Component.VC.Llvm.Clang",
"Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Llvm.Clang",
"Microsoft.VisualStudio.Workload.NativeDesktop",
"Microsoft.Component.NetFX.Native",
"Microsoft.VisualStudio.ComponentGroup.UWP.NetCoreAndStandard",
"Microsoft.VisualStudio.Component.Graphics",
"Microsoft.VisualStudio.ComponentGroup.UWP.Xamarin",
"Microsoft.VisualStudio.ComponentGroup.UWP.Support",
"Microsoft.VisualStudio.Component.VC.Tools.ARM64",
"Microsoft.VisualStudio.Component.UWP.VC.ARM64",
"Microsoft.VisualStudio.Component.VC.Tools.ARM",
"Microsoft.VisualStudio.ComponentGroup.UWP.VC",
"Microsoft.VisualStudio.Workload.Universal",
"Microsoft.Component.ClickOnce"
]
} And here I have dropped at least the Azure workload: {
"version": "1.0",
"components": [
"Microsoft.VisualStudio.Component.CoreEditor",
"Microsoft.VisualStudio.Workload.CoreEditor",
"Microsoft.NetCore.Component.Runtime.5.0",
"Microsoft.NetCore.Component.Runtime.3.1",
"Microsoft.NetCore.Component.SDK",
"Microsoft.VisualStudio.Component.NuGet",
"Microsoft.Net.Component.4.6.1.TargetingPack",
"Microsoft.VisualStudio.Component.Roslyn.Compiler",
"Microsoft.VisualStudio.Component.Roslyn.LanguageServices",
"Microsoft.VisualStudio.Component.FSharp",
"Microsoft.ComponentGroup.ClickOnce.Publish",
"Microsoft.NetCore.Component.DevelopmentTools",
"Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions",
"Microsoft.VisualStudio.Component.DockerTools",
"Microsoft.Net.Component.4.8.SDK",
"Microsoft.Net.Component.4.7.2.TargetingPack",
"Microsoft.Net.ComponentGroup.DevelopmentPrerequisites",
"Microsoft.VisualStudio.Component.TypeScript.4.0",
"Microsoft.VisualStudio.Component.JavaScript.TypeScript",
"Microsoft.VisualStudio.Component.JavaScript.Diagnostics",
"Microsoft.Component.MSBuild",
"Microsoft.VisualStudio.Component.TextTemplating",
"Component.Microsoft.VisualStudio.RazorExtension",
"Microsoft.VisualStudio.Component.IISExpress",
"Microsoft.VisualStudio.Component.SQL.ADAL",
"Microsoft.VisualStudio.Component.SQL.LocalDB.Runtime",
"Microsoft.VisualStudio.Component.Common.Azure.Tools",
"Microsoft.VisualStudio.Component.SQL.CLR",
"Microsoft.VisualStudio.Component.MSODBC.SQL",
"Microsoft.VisualStudio.Component.MSSQL.CMDLnUtils",
"Microsoft.VisualStudio.Component.ManagedDesktop.Core",
"Microsoft.Net.Component.4.5.2.TargetingPack",
"Microsoft.Net.Component.4.5.TargetingPack",
"Microsoft.VisualStudio.Component.SQL.SSDT",
"Microsoft.VisualStudio.Component.SQL.DataSources",
"Component.Microsoft.Web.LibraryManager",
"Microsoft.VisualStudio.ComponentGroup.Web",
"Microsoft.VisualStudio.Component.Web",
"Microsoft.VisualStudio.Component.IntelliCode",
"Microsoft.Net.Component.4.TargetingPack",
"Microsoft.Net.Component.4.5.1.TargetingPack",
"Microsoft.Net.Component.4.6.TargetingPack",
"Microsoft.Net.ComponentGroup.TargetingPacks.Common",
"Microsoft.Net.Core.Component.SDK.2.1",
"Microsoft.VisualStudio.Component.IntelliTrace.FrontEnd",
"Microsoft.VisualStudio.Component.DiagnosticTools",
"Microsoft.VisualStudio.Component.EntityFramework",
"Microsoft.VisualStudio.Component.LiveUnitTesting",
"Microsoft.VisualStudio.Component.AppInsights.Tools",
"Microsoft.VisualStudio.Component.Debugger.JustInTime",
"Microsoft.VisualStudio.Component.Wcf.Tooling",
"Microsoft.VisualStudio.Component.ClassDesigner",
"Microsoft.VisualStudio.Component.GraphDocument",
"Microsoft.VisualStudio.Component.CodeMap",
"Microsoft.VisualStudio.Component.VC.CoreIde",
"Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
"Microsoft.VisualStudio.Component.Graphics.Tools",
"Microsoft.VisualStudio.Component.VC.DiagnosticTools",
"Microsoft.VisualStudio.Component.Windows10SDK.18362",
"Microsoft.VisualStudio.Component.ManagedDesktop.Prerequisites",
"Microsoft.ComponentGroup.Blend",
"Microsoft.VisualStudio.Component.DotNetModelBuilder",
"Microsoft.VisualStudio.Component.FSharp.Desktop",
"Microsoft.VisualStudio.ComponentGroup.MSIX.Packaging",
"Microsoft.VisualStudio.Workload.ManagedDesktop",
"Microsoft.VisualStudio.Component.VC.Redist.14.Latest",
"Microsoft.VisualStudio.ComponentGroup.ArchitectureTools.Native",
"Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core",
"Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions.CMake",
"Microsoft.VisualStudio.Component.VC.CMake.Project",
"Microsoft.VisualStudio.Component.VC.ATL",
"Microsoft.VisualStudio.Component.VC.TestAdapterForBoostTest",
"Microsoft.VisualStudio.Component.VC.TestAdapterForGoogleTest",
"Microsoft.VisualStudio.Component.VC.ASAN",
"Microsoft.VisualStudio.Component.VC.Llvm.ClangToolset",
"Microsoft.VisualStudio.Component.VC.Llvm.Clang",
"Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Llvm.Clang",
"Microsoft.VisualStudio.Workload.NativeDesktop",
"Microsoft.Component.NetFX.Native",
"Microsoft.VisualStudio.ComponentGroup.UWP.NetCoreAndStandard",
"Microsoft.VisualStudio.Component.Graphics",
"Microsoft.VisualStudio.ComponentGroup.UWP.Xamarin",
"Microsoft.VisualStudio.ComponentGroup.UWP.Support",
"Microsoft.VisualStudio.Component.VC.Tools.ARM64",
"Microsoft.VisualStudio.Component.UWP.VC.ARM64",
"Microsoft.VisualStudio.Component.VC.Tools.ARM",
"Microsoft.VisualStudio.ComponentGroup.UWP.VC",
"Microsoft.VisualStudio.Workload.Universal",
"Microsoft.Component.ClickOnce"
]
} I'm not aware of an easy way to pare this down to the purely minimal set of components that are required to build the solution. In addition, I would imagine that you might also want it segregated into product and test components in the event that you are not interested in the tests. |
For reference, this is the Dockerfile I've come up with to build winget: # escape=`
FROM mcr.microsoft.com/windows:20H2 as winget-builder
USER ContainerAdministrator
ADD [ "https://aka.ms/vs/16/release/vc_redist.x64.exe", "C:\\TEMP\\" ]
RUN C:\TEMP\vc_redist.x64.exe /install /passive /norestart /log C:\TEMP\vc_redist.log
ADD [ "https://raw.githubusercontent.com/MisterDA/Windows-OCaml-Docker/images/Install.cmd", "C:\\TEMP\\" ]
ADD [ "https://aka.ms/vscollect.exe", "C:\\TEMP\\collect.exe" ]
ADD [ "https://aka.ms/vs/16/release/channel", "C:\\TEMP\\VisualStudio.chman" ]
ADD [ "https://aka.ms/vs/16/release/vs_buildtools.exe", "C:\\TEMP\\vs_buildtools.exe" ]
RUN C:\TEMP\Install.cmd C:\TEMP\vs_buildtools.exe --quiet --wait --norestart --nocache `
--installPath C:\BuildTools --channelUri C:\TEMP\VisualStudio.chman `
--installChannelUri C:\TEMP\VisualStudio.chman `
--add Microsoft.VisualStudio.Workload.ManagedDesktopBuildTools `
--add Microsoft.VisualStudio.Workload.VCTools `
--add Microsoft.VisualStudio.Workload.UniversalBuildTools `
--add Microsoft.VisualStudio.Workload.MSBuildTools `
--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 `
--add Microsoft.VisualStudio.Component.Windows10SDK.18362
ADD [ "https://github.com/microsoft/winget-cli/archive/master.zip", "C:\\TEMP\\winget-cli.zip" ]
RUN powershell -Command "Expand-Archive -LiteralPath C:\TEMP\winget-cli.zip -DestinationPath C:\TEMP\ -Force"
RUN cd C:\TEMP && rename winget-cli-master winget-cli
RUN cd C:\BuildTools\VC\Auxiliary\Build && vcvarsall.bat x64 && cd C:\TEMP\winget-cli && msbuild -t:restore -m -p:RestorePackagesConfig=true -p:Configuration=Release src\AppInstallerCLI.sln
RUN cd C:\BuildTools\VC\Auxiliary\Build && vcvarsall.bat x64 && cd C:\TEMP\winget-cli && msbuild -p:Configuration=Release src\AppInstallerCLI.sln
RUN mkdir "C:\Program Files\winget-cli"
RUN move "C:\TEMP\winget-cli\src\x64\Release\AppInstallerCLI\AppInstallerCLI.exe" "C:\Program Files\winget-cli\winget.exe"
RUN move "C:\TEMP\winget-cli\src\x64\Release\AppInstallerCLI\resources.pri" "C:\Program Files\winget-cli\" |
If you are mostly interested in getting binaries in the container to then run, you could acquire them from the commit build. For instance: I don't know if there is a single URL that one could use to get "AppInstallerCLI.exe from the artifacts of the latest build for branch foo". Nor am I particularly familiar with Dockerfiles to know if you could process it there, but I you could run a shell script that could do it at a minimum. If that is what you want, we can also publish the resources.pri file to the artifacts so that it can run. I think this would fall into the unofficially supported category. I want this flow to keep working, but it is not a method that we currently ship and so if it broke and was extremely expensive to fix, it might be down for some time. |
I am very interested in using winget in our Dockerfile builds for Windows containers, which seems like the sort of thing it is designed for. But installing in a container doesn't seem to work. Having the raw .exe available could be a good workaround?
|
You can try this to download and install a build of the latest release from GitHub: #escape=`
FROM mcr.microsoft.com/windows:20H2
USER ContainerAdministrator
ADD [ "https://github.com/microsoft/winget-cli/releases/latest/download/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle", "C:\\TEMP\\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.zip" ]
RUN powershell -Command "Expand-Archive -LiteralPath C:\TEMP\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.zip -DestinationPath C:\TEMP\winget-cli -Force"
RUN ren C:\TEMP\winget-cli\AppInstaller_x64.msix AppInstaller_x64.zip
RUN powershell -Command "Expand-Archive -LiteralPath C:\TEMP\winget-cli\AppInstaller_x64.zip -DestinationPath C:\TEMP\winget-cli\ -Force"
RUN mkdir "C:\Program Files\winget-cli" && `
move "C:\TEMP\winget-cli\\AppInstallerCLI.exe" "C:\Program Files\winget-cli\winget.exe" && `
move "C:\TEMP\winget-cli\\resources.pri" "C:\Program Files\winget-cli\" |
@denelon @MisterDA I've tried the method above, extracted both the DesktopInstaller package and the VCLibs package, copied the VCLibs DLLs next to the winget.exe client and searched for packages with success. (All this in a 20H2 Win10 docker container.) However I can't install the store package I'd like, because I'm getting an error:
I'd need this package badly to run OpenCL code in CI. |
@MathiasMagnus we're working on eliminating the requirement to be signed into the Microsoft Store via MSA for free packages rated "e" for everyone. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Hello,
I’m trying to build winget in a Windows container, using Docker for Windows.
Could you describe exactly what is the minimal set of Visual Studio Build Tools components required? I’m not sure what this maps to.
Also, the page at https://docs.microsoft.com/en-us/windows/package-manager/winget/#open-source-details only lists the C++ workload.
Thank you!
The text was updated successfully, but these errors were encountered: