Skip to content

Update installer script to support UCRT and check for the versions of VS that support UCRT.#745

Open
LightBender wants to merge 1 commit into
dlang:masterfrom
LightBender:ucrt
Open

Update installer script to support UCRT and check for the versions of VS that support UCRT.#745
LightBender wants to merge 1 commit into
dlang:masterfrom
LightBender:ucrt

Conversation

@LightBender

Copy link
Copy Markdown
Contributor

This PR updates the installer to note the use of UCRT and the VS detection logic to look for all versions of VS that support the UCRT.

This PR is paired with dlang/dmd#23345.

@rainers rainers left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See also #725 that has become outdated by the release of VS 2026.

LangString DESC_AddD2ToPath ${LANG_ENGLISH} "Modify the PATH environment variable so DMD can be used from any command prompt"

LangString DESC_VisualDDownload ${LANG_ENGLISH} "Visual Studio package providing both project management and language services. It works with Visual Studio 2008-2017 (and the free VS Shells)"
LangString DESC_VisualDDownload ${LANG_ENGLISH} "Visual Studio package providing both project management and language services. It works with Visual Studio 2019 and later"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Visual D should still work fine on VS 2012+ (one bug report for VS 2008). If we detect still VS 2015 below, we don't have to be more restrictive here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did remove the below-2015 detection because UCRT is not supported below 2015, and we are talking about an 11 year old version of VS that is entirely unsupported by Microsoft. I can modify the language to say 2015 and later?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm ok with removing support for the old VS versions. I just meant that the description only mentions support for VS2019 or later, but VS2015 and VS2017 are detected below. Maybe just remove the sentence "It works with...".

Comment thread windows/d2-installer.nsi
!define VS2013Filename "vs_community2013.exe"
!define VS2017Filename "vs_community2017.exe"
!define VS2017BTFilename "vs_BuildTools2017.exe"
!define VS2019Filename "vs_community2019.exe"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dmd still comes with a 32-bit executable. VS2019 is the last VS version that runs on a 32-bit system. If we want to support that, we might want to keep that option.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does DMD need to be called by a 32-bit version of VS? IIRC this should not be a limitation.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, but we install a 32-bit version of dmd to support a 32-bit host-OS. You cannot install VS2022 or VS2026 on that system, though. Either we ignore that, or don't provide the option to install VS on a 32-bit host, or switch to VS2019 in that case.

Comment thread windows/d2-installer.nsi
StrCpy $1 "VC2026"
StrCmp $0 "" not_vc2026 vs2026
vs2026:
${LineRead} "$0\VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt" "1" $2

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't work on your system that misses this file.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can probably make it use the same registry based detection used elsewhere. Let me see about that.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you don't need these VS2022/VS2026 detection, DetectVC should be good enough. See also https://github.com/dlang/installer/pull/725/changes#diff-179a67f45668adad5ec8526432aeda299d6c08b4df2bb5349f37489fda1674d4R344

Comment thread windows/d2-installer.nsi
ClearErrors
ReadRegStr $0 HKLM "${VCRedistx86RegKey}" "ProductName"
IfErrors 0 vcredistx86_installed
ReadRegDWORD $0 HKLM "${VCRedistx86RegKey}" "Installed"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to detect/install the UCRT only, not the VC redistributable? Might avoid running an extra installation if the UCRT is preinstalled with Win11.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not by itself. UCRT is available on all Windows10/11 installs by default, so we can assume it's presence on those, an OS Major Version number would be sufficient, but below those detection is an ... interesting question. One possible route is to look for the existence of C:\Windows\System32\ucrtbase.dll

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember installing the UCRT was quite a hassle on Windows 7. Might be ok to just mention that the VC runtime installer should be used on pre-Win10 systems (does it still work there?) and keep the "do nothing" option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants