Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade core version to net6.0 #231

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion samples/BuilderApp/BuilderApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net472;netcoreapp3.1;net6.0</TargetFrameworks>
<TargetFrameworks>net472;net6.0</TargetFrameworks>
<CopyLocalLockFileAssemblies>false</CopyLocalLockFileAssemblies>
<IsPackable>false</IsPackable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net472;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net472;net6.0</TargetFrameworks>
<IsPackable>false</IsPackable>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\MSBuildLocator\key.snk</AssemblyOriginatorKeyFile>
Expand Down
21 changes: 16 additions & 5 deletions src/MSBuildLocator/DotNetSdkLocationHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ internal static class DotNetSdkLocationHelper
private static readonly Regex DotNetBasePathRegex = new Regex("Base Path:(.*)$", RegexOptions.Multiline);
private static readonly Regex VersionRegex = new Regex(@"^(\d+)\.(\d+)\.(\d+)", RegexOptions.Multiline);
private static readonly Regex SdkRegex = new Regex(@"(\S+) \[(.*?)]$", RegexOptions.Multiline);
private static readonly bool IsWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);

public static VisualStudioInstance GetInstance(string dotNetSdkPath)
{
Expand Down Expand Up @@ -98,7 +99,13 @@ private static string FindDotnetFromEnvironmentVariable(string environmentVariab
string fullPathToDotnetFromRoot = Path.Combine(dotnet_root, exeName);
if (File.Exists(fullPathToDotnetFromRoot))
{
return realpath(fullPathToDotnetFromRoot) ?? fullPathToDotnetFromRoot;
if (!IsWindows)
{
fullPathToDotnetFromRoot = realpath(fullPathToDotnetFromRoot) ?? fullPathToDotnetFromRoot;
return File.Exists(fullPathToDotnetFromRoot) ? Path.GetDirectoryName(fullPathToDotnetFromRoot) : null;
}

return dotnet_root;
}
}

Expand All @@ -108,8 +115,7 @@ private static string FindDotnetFromEnvironmentVariable(string environmentVariab
private static IEnumerable<string> GetDotNetBasePaths(string workingDirectory)
{
string dotnetPath = null;
bool isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
string exeName = isWindows ? "dotnet.exe" : "dotnet";
string exeName = IsWindows ? "dotnet.exe" : "dotnet";

// First check for the DOTNET_ROOT environment variable, as it's often there as with, for example, dotnet format.
if (IntPtr.Size == 4)
Expand All @@ -135,10 +141,15 @@ private static IEnumerable<string> GetDotNetBasePaths(string workingDirectory)
string filePath = Path.Combine(dir, exeName);
if (File.Exists(filePath))
{
if (!isWindows)
if (!IsWindows)
{
filePath = realpath(filePath) ?? filePath;
if (!File.Exists(filePath))
if (File.Exists(filePath))
{
dotnetPath = Path.GetDirectoryName(filePath);
break;
}
else
{
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion src/MSBuildLocator/Microsoft.Build.Locator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFrameworks>net46;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net46;net6.0</TargetFrameworks>
<DebugType>full</DebugType>

<CopyLocalLockFileAssemblies>false</CopyLocalLockFileAssemblies>
Expand Down
Loading