@@ -865,27 +865,32 @@ export function findNetFrameworkTargetFramework(project: MSBuildProject): Target
865865 return project . TargetFrameworks . find ( tf => regexp . test ( tf . ShortName ) ) ;
866866}
867867
868- export function findNet5TargetFramework ( project : MSBuildProject ) : TargetFramework {
869- const targetFramework = project . TargetFrameworks . find ( tf => tf . ShortName . startsWith ( 'net5' ) ) ;
870- // Temprorary workaround until changes to support the net5.0 TFM is settled. Some NuGet
871- // builds report the shortname as net50.
872- if ( targetFramework !== undefined ) {
873- targetFramework . ShortName = "net5.0" ;
874- }
875- return targetFramework ;
868+ export function findNetCoreTargetFramework ( project : MSBuildProject ) : TargetFramework {
869+ return findNetCoreAppTargetFramework ( project ) ?? findModernNetFrameworkTargetFramework ( project ) ;
876870}
877871
878872export function findNetCoreAppTargetFramework ( project : MSBuildProject ) : TargetFramework {
879873 return project . TargetFrameworks . find ( tf => tf . ShortName . startsWith ( 'netcoreapp' ) ) ;
880874}
881875
876+ export function findModernNetFrameworkTargetFramework ( project : MSBuildProject ) : TargetFramework {
877+ let regexp = new RegExp ( '^net[5-6]' ) ;
878+ const targetFramework = project . TargetFrameworks . find ( tf => regexp . test ( tf . ShortName ) ) ;
879+
880+ // Shortname is being reported as net50 instead of net5.0
881+ if ( targetFramework !== undefined && targetFramework . ShortName . charAt ( 4 ) !== "." ) {
882+ targetFramework . ShortName = targetFramework . ShortName . substr ( 0 , 4 ) + "." + targetFramework . ShortName . substr ( 4 ) ;
883+ }
884+
885+ return targetFramework ;
886+ }
887+
882888export function findNetStandardTargetFramework ( project : MSBuildProject ) : TargetFramework {
883889 return project . TargetFrameworks . find ( tf => tf . ShortName . startsWith ( 'netstandard' ) ) ;
884890}
885891
886892export function isDotNetCoreProject ( project : MSBuildProject ) : Boolean {
887- return findNet5TargetFramework ( project ) !== undefined ||
888- findNetCoreAppTargetFramework ( project ) !== undefined ||
893+ return findNetCoreTargetFramework ( project ) !== undefined ||
889894 findNetStandardTargetFramework ( project ) !== undefined ||
890895 findNetFrameworkTargetFramework ( project ) !== undefined ;
891896}
@@ -928,8 +933,7 @@ export function findExecutableMSBuildProjects(projects: MSBuildProject[]) {
928933 let result : MSBuildProject [ ] = [ ] ;
929934
930935 projects . forEach ( project => {
931- const projectIsNotNetFramework = findNetCoreAppTargetFramework ( project ) !== undefined
932- || findNet5TargetFramework ( project ) !== undefined
936+ const projectIsNotNetFramework = findNetCoreTargetFramework ( project ) !== undefined
933937 || project . IsBlazorWebAssemblyStandalone ;
934938
935939 if ( project . IsExe && projectIsNotNetFramework ) {
0 commit comments