I recently posted an announcement about An Introduction to Programming Using Swift (see An Introduction to Programming Using Swift). Someone responded with a suggestion concerning installation of Swift under Windows and provided the following URL:
Install Swift - Windows | Swift.org
I took a look at this page in hopes of updating Appendix B of my book, but I've run into a few problems.
- Trying to install Visual Studio on Win 10 using:
winget install --id Microsoft.VisualStudio.2022.Community --exact --force --custom "--add Microsoft.VisualStudio.Component.Windows11SDK.22621 --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.VC.Tools.ARM64"
produced errors if there are any old versions (or even vestiges) of VSC laying around. I was able to manually install VSC using the VSC install, though I'm not sure it did everything the winget command specifies. ChatGPT recommends this:
winget uninstall Microsoft.VisualStudio.2019.Community
winget uninstall Microsoft.VisualStudio.2017.Community
winget install --id Microsoft.VisualStudio.2022.Community --exact --force \
--custom "--add Microsoft.VisualStudio.Component.Windows11SDK.22621 \
--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 \
--add Microsoft.VisualStudio.Component.VC.Tools.ARM64"
though I didn't try this.
After I (manually) deleted everything, this scheme worked (to install VSC).
Installing Swift using the command:
winget install --id Swift.Toolchain -e
Worked fine. I was able to build the CLI hello world program without any issues.
However, when I clicked on the "Install Swift Extension" from "Select an editor (Visual Studio Code"), it bounced me from my Parallels/Win 10 window to macOS and wanted to install this on the Mac side. I tried looking for @id:swiftlang.swift-vscode inside VSC, but nothing ever showed up. What am I missing here?
I then installed a clean version of Win 11 under Parallels (all on an x86 iMac Pro) and tried the winget command. I got the following output (admin-enabled powershell)![]()
PS C:\WINDOWS\system32> winget install --id Microsoft.VisualStudio.2022.Community --exact --force --custom "--add Microsoft.VisualStudio.Component.Windows11SDK.22621 --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.VC.Tools.ARM64"
Failed when searching source: msstore
An unexpected error occurred while executing the command:
0x8a15005e : The server certificate did not match any of the expected values.
The following packages were found among the working sources.
Please specify one of them using the --source option to proceed.
Name Id Source
-------------------------------------------------------------------------
Visual Studio Community 2022 Microsoft.VisualStudio.2022.Community winget
Any ideas?
I'd like to update Appendix B in my book, but so far I've not been successful in running any of these installation scripts.
Thanks
Randy Hyde