Skip to content

Commit e544bcb

Browse files
committed
Fall back to net10.0 when SDK folder has no version
Visual Studio MSBuild SDK path has no version, so Version.Parse failed.
1 parent feefb16 commit e544bcb

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎eng/SharpCpp.Build.props‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@
3737
<SharpCppE2ENativeLibraryPath>$(SharpCppOutputDir)/$(SharpCppSharedLibraryPrefix)SharpCppTestsE2E_Native$(SharpCppSharedLibrarySuffix)</SharpCppE2ENativeLibraryPath>
3838

3939
<SharpCppSdkVersion>$([System.IO.Path]::GetFileName($([System.IO.Path]::GetDirectoryName('$(MSBuildSDKsPath)'))))</SharpCppSdkVersion>
40-
<TargetFramework Condition="'$(TargetFramework)' == ''">net$([System.Version]::Parse('$(SharpCppSdkVersion)').Major).0</TargetFramework>
40+
<TargetFramework Condition="'$(TargetFramework)' == '' and $([System.Text.RegularExpressions.Regex]::IsMatch('$(SharpCppSdkVersion)', '^[0-9]+\.[0-9]+'))">net$([System.Version]::Parse('$(SharpCppSdkVersion)').Major).0</TargetFramework>
41+
<!-- Visual Studio MSBuild keeps its SDKs in a folder that has no version in its name. -->
42+
<TargetFramework Condition="'$(TargetFramework)' == ''">net10.0</TargetFramework>
4143
<Nullable>enable</Nullable>
4244
<ImplicitUsings>enable</ImplicitUsings>
4345
<LangVersion>latest</LangVersion>

0 commit comments

Comments
 (0)