@@ -217,6 +217,34 @@ mod impl_ {
217
217
}
218
218
}
219
219
220
+ fn vs16_instance ( ) -> Option < PathBuf > {
221
+ vs15_instances ( ) ?. find_map ( |instance| {
222
+ let instance = instance. ok ( ) ?;
223
+ let installation_name = instance. installation_name ( ) . ok ( ) ?; ;
224
+ if installation_name. to_str ( ) ?. starts_with ( "VisualStudio/16." ) {
225
+ Some ( PathBuf :: from ( instance. installation_path ( ) . ok ( ) ?) )
226
+ } else {
227
+ None
228
+ }
229
+ } )
230
+ }
231
+
232
+ fn find_tool_in_vs16_path ( tool : & str , target : & str ) -> Option < Tool > {
233
+ let path = vs16_instance ( ) ?. join ( tool) ;
234
+ if !path. is_file ( ) {
235
+ return None ;
236
+ }
237
+ let mut tool = Tool :: new ( path) ;
238
+ if target. contains ( "x86_64" ) {
239
+ tool. env . push ( ( "Platform" . into ( ) , "X64" . into ( ) ) ) ;
240
+ }
241
+ Some ( tool)
242
+ }
243
+
244
+ fn find_msbuild_vs16 ( target : & str ) -> Option < Tool > {
245
+ find_tool_in_vs16_path ( r"MSBuild\Current\Bin\MSBuild.exe" , target)
246
+ }
247
+
220
248
// In MSVC 15 (2017) MS once again changed the scheme for locating
221
249
// the tooling. Now we must go through some COM interfaces, which
222
250
// is super fun for Rust.
@@ -662,6 +690,10 @@ mod impl_ {
662
690
663
691
pub fn has_msbuild_version ( version : & str ) -> bool {
664
692
match version {
693
+ "16.0" => {
694
+ find_msbuild_vs16 ( "x86_64-pc-windows-msvc" ) . is_some ( )
695
+ || find_msbuild_vs16 ( "i686-pc-windows-msvc" ) . is_some ( )
696
+ }
665
697
"15.0" => {
666
698
find_msbuild_vs15 ( "x86_64-pc-windows-msvc" ) . is_some ( )
667
699
|| find_msbuild_vs15 ( "i686-pc-windows-msvc" ) . is_some ( )
0 commit comments