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 to net9.0-rc #599

Merged
merged 3 commits into from
Sep 26, 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
2 changes: 2 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@
<ContinuousIntegrationBuild Condition="'$(TF_BUILD)' == 'true'">true</ContinuousIntegrationBuild>
<NoWarn>$(NoWarn);NETSDK1213</NoWarn>
<TargetDotNet9 Condition="'$(ContinuousIntegrationBuild)' == 'true'">true</TargetDotNet9>
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
<UseArtifactsOutput>false</UseArtifactsOutput>
</PropertyGroup>
</Project>
24 changes: 24 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,28 @@
Condition="'$(VsSDKVersion)' != ''" />
</ItemGroup>
</Target>
<!-- BEGIN workaround for https://github.com/dotnet/sdk/issues/43339; remove after updated to VS 17.12 or a future 17.11 patch -->
<Target Name="WorkaroundDotnetSdk43339" BeforeTargets="ResolvePackageAssets" Condition=" '$(MSBuildRuntimeType)' == 'Full' and $([MSBuild]::VersionLessThan($(MSBuildVersion), 17.12.0))">
<PrimeSystemTextJson804 />
</Target>
<UsingTask
TaskName="PrimeSystemTextJson804"
TaskFactory="RoslynCodeTaskFactory"
AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll" >
<Task>
<Code Type="Fragment" Language="cs">
<![CDATA[
try
{
System.Reflection.Assembly.LoadFrom(@"$(MicrosoftNETBuildTasksDirectoryRoot)\..\..\..\DotnetTools\dotnet-format\BuildHost-net472\System.Text.Json.dll");
}
catch
{
// Best effort: if something moves in the SDK don't break the build.
}
]]>
</Code>
</Task>
</UsingTask>
<!-- END workaround for https://github.com/dotnet/sdk/issues/43339 -->
</Project>
34 changes: 19 additions & 15 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,39 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<MicrosoftBuildPackageVersion>17.8.3</MicrosoftBuildPackageVersion>
<MicrosoftBuildPackageVersion Condition="'$(TargetFramework)' == 'net461'">15.9.20</MicrosoftBuildPackageVersion>
<MicrosoftBuildPackageVersion Condition="'$(TargetFramework)' == 'net6.0'">17.3.2</MicrosoftBuildPackageVersion>
<MicrosoftBuildPackageVersion Condition="'$(TargetFramework)' == 'net7.0'">17.7.2</MicrosoftBuildPackageVersion>
<MicrosoftBuildPackageVersion>17.11.4</MicrosoftBuildPackageVersion>
<MicrosoftBuildPackageVersion Condition="'$(TargetFramework)' == 'net461'">16.11.0</MicrosoftBuildPackageVersion>
<SystemConfigurationConfigurationManagerPackageVersion>8.0.0</SystemConfigurationConfigurationManagerPackageVersion>
<SystemConfigurationConfigurationManagerPackageVersion Condition="'$(TargetFramework)' == 'net461'">6.0.0</SystemConfigurationConfigurationManagerPackageVersion>
<MicrosoftExtensionsFileSystemGlobbingPackageVersion>8.0.0</MicrosoftExtensionsFileSystemGlobbingPackageVersion>
<MicrosoftExtensionsFileSystemGlobbingPackageVersion Condition="'$(TargetFramework)' != 'net7.0' And '$(TargetFramework)' != 'net8.0'">6.0.0</MicrosoftExtensionsFileSystemGlobbingPackageVersion>
<MicrosoftExtensionsFileSystemGlobbingPackageVersion Condition="'$(TargetFramework)' == 'net472'">6.0.0</MicrosoftExtensionsFileSystemGlobbingPackageVersion>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="EnvironmentAbstractions" Version="3.0.2" />
<PackageVersion Include="EnvironmentAbstractions" Version="5.0.0" />
<PackageVersion Include="EnvironmentAbstractions.BannedApiAnalyzer" Version="3.0.2" />
<PackageVersion Include="EnvironmentAbstractions.TestHelpers" Version="3.0.2" />
<PackageVersion Include="McMaster.Extensions.CommandLineUtils" Version="4.1.0" />
<PackageVersion Include="EnvironmentAbstractions.TestHelpers" Version="5.0.0" />
<PackageVersion Include="McMaster.Extensions.CommandLineUtils" Version="4.1.1" />
<PackageVersion Include="Microsoft.Build" Version="$(MicrosoftBuildPackageVersion)" />
<PackageVersion Include="Microsoft.Build.Runtime" Version="$(MicrosoftBuildPackageVersion)" />
<PackageVersion Include="Microsoft.Build.Utilities.Core" Version="$(MicrosoftBuildPackageVersion)" />
<PackageVersion Include="Microsoft.Extensions.FileSystemGlobbing" Version="$(MicrosoftExtensionsFileSystemGlobbingPackageVersion)" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageVersion Include="Microsoft.Extensions.FileSystemGlobbing" Version="8.0.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageVersion Include="Microsoft.VisualStudio.ProjectSystem.SDK" Version="15.8.243" />
<PackageVersion Include="Microsoft.VisualStudio.SDK" Version="17.7.37357" />
<PackageVersion Include="Microsoft.VisualStudio.Setup.Configuration.Interop" Version="3.9.2164" />
<PackageVersion Include="Microsoft.VSSDK.BuildTools" Version="17.9.3174" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="MSBuild.ProjectCreation" Version="11.0.0" />
<PackageVersion Include="MSBuild.ProjectCreation" Version="13.0.0" />
<PackageVersion Include="Shouldly" Version="4.2.1" />
<PackageVersion Include="System.Configuration.ConfigurationManager" Version="$(SystemConfigurationConfigurationManagerPackageVersion)" />
<PackageVersion Include="xunit" Version="2.6.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.4" />
<PackageVersion Include="xunit" Version="2.9.1" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
<!-- Pinning vulnerable packages -->
<PackageVersion Include="System.Security.Cryptography.Xml" Version="8.0.1" />
<PackageVersion Include="Microsoft.IO.Redist" Version="6.0.1" />
<PackageVersion Include="System.Formats.Asn1" Version="8.0.1" />
<PackageVersion Include="System.Net.Http" Version="4.3.4" />
<PackageVersion Include="System.Text.Json" Version="8.0.4" />
<PackageVersion Include="System.Text.RegularExpressions" Version="4.3.1" />
</ItemGroup>
<ItemGroup>
<GlobalPackageReference Include="Microsoft.Build.Artifacts" Version="6.1.30" />
Expand All @@ -43,4 +47,4 @@
<GlobalPackageReference Include="Nerdbank.GitVersioning" Version="3.6.133" />
<GlobalPackageReference Include="StyleCop.Analyzers" Version="1.1.118" />
</ItemGroup>
</Project>
</Project>
42 changes: 23 additions & 19 deletions azure-pipelines-official.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,8 @@ variables:
ArtifactsDirectory: artifacts
BuildConfiguration: 'Release'
BuildPlatform: 'Any CPU'
DotNet6Version: '6.x'
DotNet7Version: '7.x'
DotNet8Version: '8.x'
DotNet9Version: '9.x'
MSBuildArgs: '"/Property:Platform=$(BuildPlatform);Configuration=$(BuildConfiguration)" "/BinaryLogger:$(Build.SourcesDirectory)\$(ArtifactsDirectoryName)\msbuild.binlog"'
SignType: 'Test'
SignType: 'Real'
trigger:
batch: true
branches:
Expand Down Expand Up @@ -49,7 +45,7 @@ extends:
mb:
signing:
enabled: true
signType: 'Test'
signType: $(SignType)
zipSources: false
outputs:
- output: pipelineArtifact
Expand Down Expand Up @@ -81,24 +77,32 @@ extends:
displayName: 'Set SignType to Real for tagged commits'
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v'))
- task: UseDotNet@2
displayName: 'Install .NET $(DotNet6Version)'
displayName: 'Install .NET 8.x'
inputs:
version: '$(DotNet6Version)'
version: '8.x'
- task: UseDotNet@2
displayName: 'Install .NET $(DotNet7Version)'
displayName: 'Install .NET 9.x'
inputs:
version: '$(DotNet7Version)'
- task: UseDotNet@2
displayName: 'Install .NET $(DotNet8Version)'
inputs:
version: '$(DotNet8Version)'
- task: UseDotNet@2
displayName: 'Install .NET $(DotNet9Version)'
inputs:
version: '$(DotNet9Version)'
version: '9.x'
includePreviewVersions: true
- task: VSBuild@1
displayName: 'Build Solution'
inputs:
solution: '**\*.sln'
msbuildArgs: '$(MSBuildArgs)'
msbuildArgs: '$(MSBuildArgs)'
- task: AzureCLI@2
displayName: 'Push SlnGen.Corext'
inputs:
azureSubscription: 'CloudBuild-Push-v2'
scriptType: 'pscore'
scriptLocation: 'inlineScript'
inlineScript: |
# Get an access token for Azure DevOp (resource id is for AzDO)
$accessToken = az account get-access-token --query accessToken --resource 499b84ac-1321-427f-aa17-267ca6975798 -o tsv

# Set the access token as a secret, so it doesn't get leaked in the logs
Write-Host "##vso[task.setsecret]$accessToken"

# Override the apitoken of the nuget service connection, for the duration of this stage
# Service connection is for "microsoft.slngen Official"
Write-Host "##vso[task.setendpoint id=d8767bc1-a109-4cb7-80c2-6ac1ebf4346e;field=authParameter;key=apitoken]$accessToken"
53 changes: 4 additions & 49 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ variables:
ArtifactsDirectoryName: 'artifacts'
BuildConfiguration: 'Debug'
BuildPlatform: 'Any CPU'
DotNet6Version: '6.x'
DotNet7Version: '7.x'
DotNet8Version: '8.x'
DotNet9Version: '9.x'
# Not using "--channel 9.0 --quality daily", see https://github.com/microsoft/slngen/issues/456
DotNet9InstallArgs: '-version 9.0.100-alpha.1.23528.2'
MSBuildArgs: '"/Property:Platform=$(BuildPlatform);Configuration=$(BuildConfiguration)"'
SignType: 'Test'

Expand Down Expand Up @@ -50,39 +44,16 @@ jobs:
vmImage: $(vmImage)
steps:
- task: UseDotNet@2
displayName: 'Install .NET $(DotNet6Version)'
displayName: 'Install .NET 8.x'
inputs:
version: '$(DotNet6Version)'
version: '8.x'

- task: UseDotNet@2
displayName: 'Install .NET $(DotNet7Version)'
displayName: 'Install .NET 9.x'
inputs:
version: '$(DotNet7Version)'

- task: UseDotNet@2
displayName: 'Install .NET $(DotNet8Version)'
inputs:
version: '$(DotNet8Version)'
version: '9.x'
includePreviewVersions: true

- script: |
powershell -NoProfile -ExecutionPolicy unrestricted -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; &([scriptblock]::Create((Invoke-WebRequest -UseBasicParsing 'https://dot.net/v1/dotnet-install.ps1'))) $(DotNet9InstallArgs) -InstallDir C:\hostedtoolcache\windows\dotnet"
dotnet --info
displayName: 'Install .NET $(DotNet9Version) (Windows)'
condition: eq(variables.osName, 'Windows')

- script: |
curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin $(DotNet9InstallArgs) --install-dir /opt/hostedtoolcache/dotnet
dotnet --info
displayName: 'Install .NET $(DotNet9Version) (Linux)'
condition: eq(variables.osName, 'Linux')

- script: |
curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin $(DotNet9InstallArgs) --install-dir /Users/runner/hostedtoolcache/dotnet
dotnet --info
displayName: 'Install .NET $(DotNet9Version) (MacOS)'
condition: eq(variables.osName, 'MacOS')

- task: VSBuild@1
displayName: 'Build (Visual Studio)'
inputs:
Expand All @@ -104,22 +75,6 @@ jobs:
testRunTitle: '$(osName) .NET Framework v4.7.2'
condition: and(succeededOrFailed(), eq(variables.osName, 'Windows'))

- task: DotNetCoreCLI@2
displayName: 'Run Unit Tests (.NET 6)'
inputs:
command: 'test'
arguments: '--no-restore --no-build --framework net6.0 /noautorsp $(MSBuildArgs) "/BinaryLogger:$(ArtifactsDirectoryName)/test-net6.0.binlog"'
testRunTitle: '$(osName) .NET 6.0'
condition: succeededOrFailed()

- task: DotNetCoreCLI@2
displayName: 'Run Unit Tests (.NET 7)'
inputs:
command: 'test'
arguments: '--no-restore --no-build --framework net7.0 /noautorsp $(MSBuildArgs) "/BinaryLogger:$(ArtifactsDirectoryName)/test-net7.0.binlog"'
testRunTitle: '$(osName) .NET 7.0'
condition: succeededOrFailed()

- task: DotNetCoreCLI@2
displayName: 'Run Unit Tests (.NET 8)'
inputs:
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "7.0.0",
"version": "9.0.100-rc.1.24452.12",
"rollForward": "latestMajor",
"allowPrerelease": true
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<PackAsTool>true</PackAsTool>
<ToolCommandName>slngen</ToolCommandName>
<RollForward>LatestMajor</RollForward>
<_GetChildProjectCopyToPublishDirectoryItems>false</_GetChildProjectCopyToPublishDirectoryItems>
<TargetDotNet9 Condition="'$(TargetDotNet9)' == '' And $([MSBuild]::VersionGreaterThanOrEquals('$(NETCoreSdkVersion)', '9.0'))">true</TargetDotNet9>
</PropertyGroup>
<Import Project="..\Shared\Shared.props" />
<ItemGroup>
Expand All @@ -15,14 +14,6 @@
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 All @@ -31,22 +22,6 @@
ReferenceOutputAssembly="false"
SkipGetTargetFrameworkProperties="true"
TargetFramework="net472" />
<ProjectReference Include="..\Microsoft.VisualStudio.SlnGen\Microsoft.VisualStudio.SlnGen.csproj"
SetTargetFramework="TargetFramework=net6.0"
IncludeAssets="None"
OutputItemType="SlnGenBuildOutput"
PrivateAssets="All"
ReferenceOutputAssembly="false"
SkipGetTargetFrameworkProperties="true"
TargetFramework="net6.0" />
<ProjectReference Include="..\Microsoft.VisualStudio.SlnGen\Microsoft.VisualStudio.SlnGen.csproj"
SetTargetFramework="TargetFramework=net7.0"
IncludeAssets="None"
OutputItemType="SlnGenBuildOutput"
PrivateAssets="All"
ReferenceOutputAssembly="false"
SkipGetTargetFrameworkProperties="true"
TargetFramework="net7.0" />
<ProjectReference Include="..\Microsoft.VisualStudio.SlnGen\Microsoft.VisualStudio.SlnGen.csproj"
SetTargetFramework="TargetFramework=net8.0"
IncludeAssets="None"
Expand All @@ -62,8 +37,7 @@
PrivateAssets="All"
ReferenceOutputAssembly="false"
SkipGetTargetFrameworkProperties="true"
TargetFramework="net9.0"
Condition="'$(TargetDotNet9)' == 'true'" />
TargetFramework="net9.0" />
</ItemGroup>
<Target Name="CopySlnGenToOutputDirectoryAndPackage"
AfterTargets="PrepareForRun"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetDotNet9 Condition="'$(TargetDotNet9)' == '' And $([MSBuild]::VersionGreaterThanOrEquals('$(NETCoreSdkVersion)', '9.0'))">true</TargetDotNet9>
<TargetFrameworks>net472;net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks Condition="'$(TargetDotNet9)' == 'true'">$(TargetFrameworks);net9.0</TargetFrameworks>
<TargetFrameworks>net472;net8.0;net9.0</TargetFrameworks>
<IsPackable>false</IsPackable>
<NoWarn>$(NoWarn);SA1600</NoWarn>
</PropertyGroup>
Expand Down
8 changes: 2 additions & 6 deletions src/Microsoft.VisualStudio.SlnGen.UnitTests/TestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,9 @@ namespace Microsoft.VisualStudio.SlnGen.UnitTests
public abstract class TestBase : MSBuildTestBase
{
private const string DotNetSdkVersion =
#if NET6_0
"6.0.0";
#elif NET7_0 || NETFRAMEWORK
"7.0.0";
#elif NET8_0
#if NET8_0
"8.0.0";
#elif NET9_0
#elif NET9_0 || NETFRAMEWORK
"9.0.0";
#else
Unknown target framework
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetDotNet9 Condition="'$(TargetDotNet9)' == '' And $([MSBuild]::VersionGreaterThanOrEquals('$(NETCoreSdkVersion)', '9.0'))">true</TargetDotNet9>
<OutputType>Exe</OutputType>
<TargetFrameworks>net461;net472;net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks Condition="'$(TargetDotNet9)' == 'true'">$(TargetFrameworks);net9.0</TargetFrameworks>
<TargetFrameworks>net472;net8.0;net9.0</TargetFrameworks>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.config</AllowedOutputExtensionsInPackageBuildOutputFolder>
<IncludeReferenceCopyLocalPathsInBuildOutputInPackage>true</IncludeReferenceCopyLocalPathsInBuildOutputInPackage>
<IsTool>true</IsTool>
Expand All @@ -28,14 +26,11 @@
<PackageReference Include="System.Configuration.ConfigurationManager" ExcludeAssets="Runtime" />
</ItemGroup>
<ItemGroup>
<Reference Include="$(PkgMicrosoft_Build_Runtime)\contentFiles\any\net46\MSBuild.exe" Private="false" Condition="'$(TargetFramework)' == 'net461'" />
<Reference Include="$(PkgMicrosoft_Build_Runtime)\contentFiles\any\net472\MSBuild.exe" Private="false" Condition="'$(TargetFramework)' == 'net472'" />
<Reference Include="$(PkgMicrosoft_Build_Runtime)\contentFiles\any\net6.0\MSBuild.dll" Private="false" Condition="'$(TargetFramework)' == 'net6.0'" />
<Reference Include="$(PkgMicrosoft_Build_Runtime)\contentFiles\any\net7.0\MSBuild.dll" Private="false" Condition="'$(TargetFramework)' == 'net7.0'" />
<Reference Include="$(PkgMicrosoft_Build_Runtime)\contentFiles\any\net8.0\MSBuild.dll" Private="false" Condition="'$(TargetFramework)' == 'net8.0' Or '$(TargetFramework)' == 'net9.0'" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" Condition="'$(TargetFramework)' == 'net461' Or '$(TargetFramework)' == 'net472'" />
<None Include="App.config" Condition="'$(TargetFramework)' == 'net472'" />
<None Include="Microsoft.VisualStudio.SlnGen.targets" Pack="true" PackagePath="build/;buildMultiTargeting/" />
</ItemGroup>
<!--
Expand Down
Loading