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

Build for .NET 5, 6, 7, 8 & 9 and ReferenceAssemblies.Default to loca… #1196

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<UsingToolSymbolUploader>true</UsingToolSymbolUploader>
<UsingToolNuGetRepack>true</UsingToolNuGetRepack>
<UsingToolIbcOptimization>true</UsingToolIbcOptimization>
<MicrosoftNetCompilersToolsetVersion>4.8.0</MicrosoftNetCompilersToolsetVersion>
<MicrosoftNetCompilersToolsetVersion>4.12.0-3.final</MicrosoftNetCompilersToolsetVersion>
<MicrosoftCodeAnalysisCSharpCodeStyleVersion>$(MicrosoftNetCompilersToolsetVersion)</MicrosoftCodeAnalysisCSharpCodeStyleVersion>
<MicrosoftCodeAnalysisVisualBasicCodeStyleVersion>$(MicrosoftNetCompilersToolsetVersion)</MicrosoftCodeAnalysisVisualBasicCodeStyleVersion>
<!-- Force prior version due to https://github.com/microsoft/vstest/pull/2192 and https://github.com/microsoft/vstest/pull/2067 -->
Expand Down Expand Up @@ -60,6 +60,7 @@
<MicrosoftVisualStudioValidationVersion>17.0.64</MicrosoftVisualStudioValidationVersion>
<NuGetSolutionRestoreManagerInteropVersion>5.6.0</NuGetSolutionRestoreManagerInteropVersion>
<StreamJsonRpcVersion>2.12.27</StreamJsonRpcVersion>
<SystemResourcesExtensionsVersion>9.0.0</SystemResourcesExtensionsVersion>
<VSLangProjVersion>$(MicrosoftVisualStudioShellPackagesVersion)</VSLangProjVersion>
<MicrosoftVisualStudioTemplateWizardInterfaceVersion>17.0.0-preview-1-30928-1111</MicrosoftVisualStudioTemplateWizardInterfaceVersion>
<MicrosoftVSSDKBuildToolsVersion>17.0.4207-preview4</MicrosoftVSSDKBuildToolsVersion>
Expand Down
6 changes: 3 additions & 3 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"sdk": {
"version": "8.0.101",
"version": "9.0.100",
"allowPrerelease": false,
"rollForward": "latestPatch"
},
"tools": {
"dotnet": "8.0.101",
"dotnet": "9.0.100",
"runtimes": {
"dotnet": [
"3.1.0"
]
},
"vs": {
"version": "17.8.0"
"version": "17.12.0"
},
"xcopy-msbuild": "17.8.1-2"
},
Expand Down
7 changes: 5 additions & 2 deletions src/Microsoft.CodeAnalysis.Testing/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,22 @@
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />

<PropertyGroup>
<!-- Required for the .NET 9 SDK to still build .NET Standard 1.6-->
<CheckNotRecommendedTargetFramework>false</CheckNotRecommendedTargetFramework>

<!--
netcoreapp3.1: Ensures full support for nullable reference types
netstandard1.6/net452: Roslyn 1.x
netstandard1.6/net46: Roslyn 2.x
netstandard2.0/net472: Roslyn 3.x
-->
<TestingLibraryTargetFrameworks>netcoreapp3.1;netstandard1.6;netstandard2.0;net452;net46;net472</TestingLibraryTargetFrameworks>
<TestingLibraryTargetFrameworks>net9.0;net8.0;net7.0;net6.0;net5.0;netcoreapp3.1;netstandard1.6;netstandard2.0;net452;net46;net472</TestingLibraryTargetFrameworks>

<!--
netcoreapp3.1: Ensures full support for nullable reference types
netstandard2.0/net472: Roslyn 3.x, starting with 3.8.0
-->
<TestingLibrarySourceGeneratorTargetFrameworks>netcoreapp3.1;netstandard2.0;net472</TestingLibrarySourceGeneratorTargetFrameworks>
<TestingLibrarySourceGeneratorTargetFrameworks>net9.0;net8.0;net7.0;net6.0;net5.0;netcoreapp3.1;netstandard2.0;net472</TestingLibrarySourceGeneratorTargetFrameworks>
</PropertyGroup>

<Choose>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1310,7 +1310,7 @@ where parameterTypes.SequenceEqual(new[] { ienumerableOfISourceGeneratorType, ty
where method is { Name: "AsSourceGenerator", IsStatic: true, IsPublic: true }
let parameterTypes = method.GetParameters().Select(parameter => parameter.ParameterType).ToArray()
where parameterTypes.SequenceEqual(new[] { iincrementalGeneratorType })
select method).SingleOrDefault();
select method).Single();
convertedSourceGeneratorsArray.SetValue(asGeneratorMethod.Invoke(null, new[] { sourceGenerators[i] }), i);
}
}
Expand All @@ -1319,7 +1319,7 @@ where parameterTypes.SequenceEqual(new[] { iincrementalGeneratorType })
where method is { Name: nameof(ImmutableArray.CreateRange), IsStatic: true, IsPublic: true }
let parameterTypes = method.GetParameters().Select(static parameter => parameter.ParameterType).ToArray()
where parameterTypes.Length == 1 && parameterTypes[0].GetGenericTypeDefinition() == typeof(IEnumerable<>)
select method).SingleOrDefault();
select method).Single();
var convertedSourceGenerators = createRangeMethod.MakeGenericMethod(isourceGeneratorType).Invoke(null, new object[] { convertedSourceGeneratorsArray });

var analyzerOptions = project.AnalyzerOptions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ public bool Equals((string filename, SourceText content) x, (string filename, So

if (x.content is null || y.content is null)
{
return ReferenceEquals(x, y);
return Equals(x, y);
}

return x.content.Encoding == y.content.Encoding
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public static Func<T, TResult> CreatePropertyAccessor<T, TResult>(Type? type, st

Expression<Func<T, TResult>> expression =
Expression.Lambda<Func<T, TResult>>(
Expression.Convert(Expression.Call(instance, property.GetMethod), typeof(TResult)),
Expression.Convert(Expression.Call(instance, property.GetMethod!), typeof(TResult)),
parameter);
return expression.Compile();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public FileSystemSemaphore(string path)
{
_path = path ?? throw new ArgumentNullException(nameof(path));

Directory.CreateDirectory(Path.GetDirectoryName(path));
Directory.CreateDirectory(Path.GetDirectoryName(path)!);
}

internal async Task<Releaser> WaitAsync(CancellationToken cancellationToken)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,17 @@ public static ReferenceAssemblies Default
{
get
{
#if NETSTANDARD1_6
#if NET9_0_OR_GREATER
return Net.Net90;
#elif NET8_0_OR_GREATER
return Net.Net80;
#elif NET7_0_OR_GREATER
return Net.Net70;
#elif NET6_0_OR_GREATER
return Net.Net60;
#elif NET5_0_OR_GREATER
return Net.Net50;
#elif NETSTANDARD1_6
return NetStandard.NetStandard16;
#elif NETSTANDARD2_0
return NetStandard.NetStandard20;
Expand Down Expand Up @@ -1532,6 +1542,7 @@ public int GetHashCode(ImmutableArray<T> obj)
}

private sealed class ImmutableDictionaryWithImmutableArrayValuesEqualityComparer<TKey, TValue> : IEqualityComparer<ImmutableDictionary<TKey, ImmutableArray<TValue>>?>
where TKey : notnull
{
public static readonly ImmutableDictionaryWithImmutableArrayValuesEqualityComparer<TKey, TValue> Instance = new();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<PackageReference Include="Microsoft.VisualStudio.Composition" Version="$(MicrosoftVisualStudioCompositionVersion)" PrivateAssets="all" />
<PackageReference Include="Microsoft.VisualStudio.Shell.Interop" Version="$(MicrosoftVisualStudioShellPackagesVersion)" PrivateAssets="all" />
<PackageReference Include="Microsoft.VisualStudio.Shell.Interop.8.0" Version="$(MicrosoftVisualStudioShellPackagesVersion)" PrivateAssets="all" />
<PackageReference Include="Microsoft.ServiceHub.Framework" Version="$(MicrosoftServiceHubFrameworkVersion)" PrivateAssets="all" />
<PackageReference Include="Microsoft.ServiceHub.Framework" Version="$(MicrosoftServiceHubFrameworkVersion)" PrivateAssets="all" />
<PackageReference Include="System.Resources.Extensions" Version="$(SystemResourcesExtensionsVersion)" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System
Imports System.Resources
Imports System.Runtime.CompilerServices
Imports System.Xml.Linq
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<Ngen>false</Ngen>
<UseCodeBase>true</UseCodeBase>
<SetupProductArch>Neutral</SetupProductArch>
<GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>
</PropertyGroup>

<!-- References -->
Expand Down Expand Up @@ -45,6 +46,7 @@
<PackageReference Include="StreamJsonRpc" Version="$(StreamJsonRpcVersion)" />
<!-- Explicit reference to avoid missing package warning -->
<PackageReference Include="Microsoft.VisualStudio.Interop" Version="$(MicrosoftVisualStudioInteropVersion)" />
<PackageReference Include="System.Resources.Extensions" Version="$(SystemResourcesExtensionsVersion)" />
</ItemGroup>

<!-- Project References -->
Expand Down
Loading