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

chore: Update roslyn packages #9753

Merged
merged 1 commit into from
Mar 2, 2024
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
21 changes: 8 additions & 13 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,14 @@
<PackageVersion Include="Jint" Version="3.0.1" />
<PackageVersion Include="JsonSchema.Net" Version="6.0.3" />
<PackageVersion Include="Markdig" Version="0.35.0" />
<!-- "17.3.2" is the latest compatible version for .NET 6 -->
<PackageVersion Include="Microsoft.Build" Version="[17.3.2]" Condition="'$(TargetFramework)' == 'net6.0'" />
<PackageVersion Include="Microsoft.Build" Version="[17.7.2]" Condition="'$(TargetFramework)' == 'net7.0'" />
<PackageVersion Include="Microsoft.Build" Version="17.9.5" Condition="'$(TargetFramework)' != 'net6.0' And '$(TargetFramework)' != 'net7.0'" />
<PackageVersion Include="Microsoft.Build.Locator" Version="1.7.1" />
<PackageVersion Include="Microsoft.CodeAnalysis" Version="4.8.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Common" Version="4.8.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.8.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.VisualBasic.Workspaces" Version="4.8.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.VisualBasic" Version="4.8.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Workspaces.Common" Version="4.8.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.8.0" />
<PackageVersion Include="Microsoft.CodeAnalysis" Version="4.9.2" />
<PackageVersion Include="Microsoft.CodeAnalysis.Common" Version="4.9.2" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.9.2" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.9.2" />
<PackageVersion Include="Microsoft.CodeAnalysis.VisualBasic.Workspaces" Version="4.9.2" />
<PackageVersion Include="Microsoft.CodeAnalysis.VisualBasic" Version="4.9.2" />
<PackageVersion Include="Microsoft.CodeAnalysis.Workspaces.Common" Version="4.9.2" />
<PackageVersion Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.9.2" />
<PackageVersion Include="Microsoft.Playwright" Version="1.40.0" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
Expand Down
2 changes: 0 additions & 2 deletions src/Docfx.Dotnet/Docfx.Dotnet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
<PackageReference Include="OneOf" />
<PackageReference Include="OneOf.SourceGenerator" />
<PackageReference Include="Markdig" />
<PackageReference Include="Microsoft.Build" ExcludeAssets="runtime" />
<PackageReference Include="Microsoft.Build.Locator" />
<PackageReference Include="Microsoft.CodeAnalysis" />
<PackageReference Include="Microsoft.CodeAnalysis.Common" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic" />
Expand Down
5 changes: 5 additions & 0 deletions src/Docfx.Dotnet/DotnetApiCatalog.Compile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ partial class DotnetApiCatalog
msbuildProperties["Configuration"] = "Release";
}

// NOTE:
// logger parameter is not works when using Roslyn 4.9.0 or later.
// It'll be fixed in later releases.
// - https://github.com/dotnet/roslyn/discussions/71950
// - https://github.com/dotnet/roslyn/issues/72202
var msbuildLogger = new ConsoleLogger(Logger.LogLevelThreshold switch
{
LogLevel.Verbose => LoggerVerbosity.Normal,
Expand Down
21 changes: 0 additions & 21 deletions src/Docfx.Dotnet/DotnetApiCatalog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using Docfx.Common;
using Docfx.Exceptions;
using Docfx.Plugins;
using Microsoft.Build.Locator;
using Newtonsoft.Json.Linq;
using YamlDotNet.Serialization;

Expand Down Expand Up @@ -59,8 +58,6 @@ internal static async Task Exec(MetadataJsonConfig config, DotnetApiOptions opti
{
var stopwatch = Stopwatch.StartNew();

EnsureMSBuildLocator();

try
{
string originalGlobalNamespaceId = VisitorHelper.GlobalNamespaceId;
Expand Down Expand Up @@ -126,24 +123,6 @@ void WriteYaml(string outputFolder, string id, Build.ApiPage.ApiPage apiPage)
}
}

private static void EnsureMSBuildLocator()
{
try
{
if (!MSBuildLocator.IsRegistered)
{
var vs = MSBuildLocator.RegisterDefaults() ?? throw new ExtractMetadataException(
$"Cannot find a supported .NET Core SDK. Install .NET Core SDK {Environment.Version.Major}.{Environment.Version.Minor}.x to build .NET API docs.");

Logger.LogInfo($"Using {vs.Name} {vs.Version}");
}
}
catch (Exception e)
{
throw new ExtractMetadataException(e.Message, e);
}
}

private static ExtractMetadataConfig ConvertConfig(MetadataJsonItemConfig configModel, string configDirectory, string outputDirectory)
{
var projects = configModel.Src;
Expand Down