Skip to content

Commit

Permalink
Fix support for MSBuild 15 (#334)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffkl authored Feb 23, 2022
1 parent f7a0759 commit 8ba9b23
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@
StrongName="StrongName" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Microsoft.VisualStudio.SlnGen\Microsoft.VisualStudio.SlnGen.csproj"
SetTargetFramework="TargetFramework=net461"
IncludeAssets="None"
OutputItemType="SlnGenBuildOutput"
PrivateAssets="All"
ReferenceOutputAssembly="false"
SkipGetTargetFrameworkProperties="true"
TargetFramework="net461" />
<ProjectReference Include="..\Microsoft.VisualStudio.SlnGen\Microsoft.VisualStudio.SlnGen.csproj"
SetTargetFramework="TargetFramework=net472"
IncludeAssets="None"
Expand Down
15 changes: 15 additions & 0 deletions src/Microsoft.VisualStudio.SlnGen.Tool/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,21 @@ public static int Main(string[] args)
return -1;
}
}
else
{
FileVersionInfo msBuildVersionInfo = FileVersionInfo.GetVersionInfo(developmentEnvironment.MSBuildExe.FullName);

switch (msBuildVersionInfo.FileMajorPart)
{
case 15:
framework = "net461";
break;

default:
framework = "net472";
break;
}
}

FileInfo slnGenFileInfo = new FileInfo(Path.Combine(thisAssemblyFileInfo.DirectoryName!, "..", thisAssemblyFileInfo.DirectoryName!.EndsWith("any") ? ".." : string.Empty, "slngen", framework, useDotnet ? "slngen.dll" : "slngen.exe"));

Expand Down

0 comments on commit 8ba9b23

Please sign in to comment.