mirror of
https://github.com/Cheviiot/Vintner.git
synced 2026-08-03 15:57:24 +00:00
Build old (pre-v145) PlatformToolset-pinned .vcxproj files
vintner only ever downloads one compiler generation, but real-world .vcxproj files are pinned to whichever PlatformToolset they were last saved under - v142 (VS2019) for anything not actively maintained is extremely common. MSBuild checks toolset "installed-ness" (MSB8020) by testing whether MSBuild/Microsoft/VC/v<schema>/Platforms/<arch>/ PlatformToolsets/<toolset>/ exists on disk - a plain file lookup our downloaded MSBuild package only satisfies for the exact generation it shipped. `install` now symlinks every historical numeric PlatformToolset name (v90 through v143) onto whichever real toolset directory is actually present, so any of them resolves transparently; Toolset.props/ .targets don't hardcode a version number, so aliasing is correct, not just a workaround. Three more MSBuild property/environment issues came with it, all found building a real years-old project against the one modern toolchain vintner installs: - VCInstallDir_<N>/VCToolsInstallDir_<N> needed a third numbering source (PlatformToolset short names from Microsoft.VCToolsVersion. v<N>.default.props) alongside the existing MSBuild schema-version and known-toolset lists, so the env-var-driven half of toolset resolution covers the same names the on-disk alias does. - VCToolsVersion must be a real version string: left unset, it falls back to a literal placeholder that then hits an unconditional version-string comparison elsewhere in Microsoft.CppBuild.targets (MSB4184). Setting it to the real installed version in turn requires CheckMSVCComponents=false, since CheckVCToolsetVersion (MSB8052) otherwise rejects an aliased PlatformToolset whenever its numeric generation doesn't match VCToolsVersion's - exactly the case aliasing creates on purpose. Everything else CheckMSVCComponents gates is diagnostic-only (MFC/ATL/Spectre presence warnings), so disabling it costs nothing else. - WindowsTargetPlatformVersion needed to become an explicit /p: global property on the msbuild command line, not just an env var: legacy .vcxproj files commonly hardcode this in a PropertyGroup, and an explicit project assignment always wins over an inherited environment variable of the same name. A command-line global property is the one thing a project file can't override. Only injected when the caller hasn't already pinned it themselves.
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
package wineenv
|
||||
|
||||
// KnownPlatformToolsets are every numeric PlatformToolset short name
|
||||
// Microsoft.Cpp.Default.props has ever defined a
|
||||
// _PlatformToolsetShortNameFor_v<N> entry for (VS2013 through the VS2022
|
||||
// initial release; excludes the _xp/_wp80/_wp81 variants, which aren't
|
||||
// purely numeric). vintner only ever installs one compiler generation, but
|
||||
// real .vcxproj files in the wild are pinned to whichever generation they
|
||||
// were last edited under - v142 (VS2019) for anything not yet retargeted is
|
||||
// extremely common. Shared between internal/install (which symlinks these
|
||||
// names onto the one real MSBuild PlatformToolsets directory) and
|
||||
// internal/wrapper (which mirrors the same names onto VCInstallDir_<N>/
|
||||
// VCToolsInstallDir_<N> for the older, environment-variable-driven toolset
|
||||
// redirect chain) - see doc comments there for why both are needed.
|
||||
var KnownPlatformToolsets = []string{"90", "100", "110", "120", "140", "141", "142", "143"}
|
||||
Reference in New Issue
Block a user