|
94 | 94 | <Output TaskParameter="IncludeDirectories" PropertyName="Includes" /> |
95 | 95 | </ProcessFlatSharpSchema> |
96 | 96 |
|
97 | | - <!-- Query the installed SDKs. --> |
98 | | - <Exec Command="dotnet --list-sdks" ConsoleToMsBuild="false"> |
| 97 | + <!-- Query the installed runtimes. --> |
| 98 | + <Exec Command="dotnet --list-runtimes" ConsoleToMsBuild="true"> |
99 | 99 | <Output TaskParameter="ConsoleOutput" PropertyName="StdOut" /> |
100 | 100 | </Exec> |
101 | 101 |
|
102 | 102 | <PropertyGroup> |
103 | | - <CompilerVersion>net9.0</CompilerVersion> |
104 | | - </PropertyGroup> |
105 | | - |
106 | | - <!-- try .net6.0. --> |
107 | | - <PropertyGroup Condition=" $([System.Text.RegularExpressions.Regex]::IsMatch($(StdOut), '6\.0\.\d+')) "> |
108 | | - <CompilerVersion>net6.0</CompilerVersion> |
109 | | - </PropertyGroup> |
110 | | - |
111 | | - <!-- try .net7.0. --> |
112 | | - <PropertyGroup Condition=" $([System.Text.RegularExpressions.Regex]::IsMatch($(StdOut), '7\.0\.\d+')) "> |
113 | | - <CompilerVersion>net7.0</CompilerVersion> |
114 | | - </PropertyGroup> |
115 | | - |
116 | | - <!-- try .net8.0. --> |
117 | | - <PropertyGroup Condition=" $([System.Text.RegularExpressions.Regex]::IsMatch($(StdOut), '8\.0\.\d+')) "> |
118 | | - <CompilerVersion>net8.0</CompilerVersion> |
119 | | - </PropertyGroup> |
120 | | - |
121 | | - <!-- try .net9.0. --> |
122 | | - <PropertyGroup Condition=" $([System.Text.RegularExpressions.Regex]::IsMatch($(StdOut), '9\.0\.\d+')) "> |
123 | | - <CompilerVersion>net9.0</CompilerVersion> |
124 | | - </PropertyGroup> |
| 103 | + <IsMatching6>$([System.Text.RegularExpressions.Regex]::IsMatch($(StdOut), '6\.0\.\d+'))</IsMatching6> |
| 104 | + <IsMatching7>$([System.Text.RegularExpressions.Regex]::IsMatch($(StdOut), '7\.0\.\d+'))</IsMatching7> |
| 105 | + <IsMatching8>$([System.Text.RegularExpressions.Regex]::IsMatch($(StdOut), '8\.0\.\d+'))</IsMatching8> |
| 106 | + <IsMatching9>$([System.Text.RegularExpressions.Regex]::IsMatch($(StdOut), '9\.0\.\d+'))</IsMatching9> |
| 107 | + <CompilerVersion>net9.0</CompilerVersion> |
| 108 | + <CompilerVersion Condition=" '$(IsMatching6)' == 'True' ">net6.0</CompilerVersion> |
| 109 | + <CompilerVersion Condition=" '$(IsMatching7)' == 'True' ">net7.0</CompilerVersion> |
| 110 | + <CompilerVersion Condition=" '$(IsMatching8)' == 'True' ">net8.0</CompilerVersion> |
| 111 | + <CompilerVersion Condition=" '$(IsMatching9)' == 'True' ">net9.0</CompilerVersion> |
| 112 | + </PropertyGroup> |
| 113 | + |
| 114 | + <Message Text=".NET runtime detection: 6: $(IsMatching6), 7: $(IsMatching7), 8: $(IsMatching8), 9: $(IsMatching9). Selected: $(CompilerVersion)" Importance="High"/> |
125 | 115 |
|
126 | 116 | <PropertyGroup> |
127 | 117 | <FlatSharpOutput>$(IntermediateOutputPath)</FlatSharpOutput> |
|
0 commit comments