Skip to content

Moving VC to .NET 8 #214

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

Merged
merged 6 commits into from
Nov 20, 2023
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
7 changes: 0 additions & 7 deletions .buildenv/BuildEnv.targets
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<!-- **********************************************************************
Environment and Test targets
*********************************************************************** -->
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets"
Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets') and '$(TestProject)' == 'true'" />


<Target Name="CompileInProjectMetadata" BeforeTargets="CreateGeneratedAssemblyInfoInputsCacheFile" Condition="'$(GenerateProjectMetadata)' == 'true' and '$(GenerateAssemblyInfo)' == 'true'">

<!--
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
dotnet-version: 8.0.x

- name: Restore dependencies
run: ./build-restore.cmd
Expand Down
4 changes: 2 additions & 2 deletions .pipelines/azure-pipelines-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ resources:
options: --entrypoint=""

variables:
VcVersion : 1.13.0
VcVersion : 1.13.1
ROOT: $(Build.SourcesDirectory)
CDP_DEFINITION_BUILD_COUNT: $[counter('', 0)] # needed for onebranch.pipeline.version task https://aka.ms/obpipelines/versioning
ENABLE_PRS_DELAYSIGN: 1
Expand All @@ -33,7 +33,7 @@ stages:
continueOnError: false
inputs:
packageType: 'sdk'
version: '6.0.406'
version: '8.0.0'
useGlobalJson: false
performMultiLevelLookup: true
workingDirectory: '$(Build.SourcesDirectory)'
Expand Down
4 changes: 2 additions & 2 deletions .pipelines/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pool:
vmImage: windows-latest

variables:
VcVersion : 1.13.0
VcVersion : 1.13.1
ROOT: $(Build.SourcesDirectory)
CDP_DEFINITION_BUILD_COUNT: $[counter('', 0)] # needed for onebranch.pipeline.version task https://aka.ms/obpipelines/versioning
ENABLE_PRS_DELAYSIGN: 1
Expand All @@ -35,7 +35,7 @@ steps:
continueOnError: false
inputs:
packageType: 'sdk'
version: '6.0.406'
version: '8.0.0'
useGlobalJson: false
performMultiLevelLookup: true
workingDirectory: '$(Build.SourcesDirectory)'
Expand Down
3 changes: 2 additions & 1 deletion build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ if /i "%VCBuildVersion%" == "" (

set VCSolutionDir=%~dp0src\VirtualClient

set TrimFlag="-p:PublishTrimmed=true -p:TrimUnusedDependencies=true"
set TrimFlag="-p:PublishTrimmed=true"
set TrimFlag=""
if /i "%~1" == "noTrim" set TrimFlag=""

call %VCSolutionDir%\build-stage-packaging-tools.cmd && echo: || Goto :Error
Expand Down
6 changes: 6 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"sdk": {
"version": "8.0.100",
"rollForward": "disable"
}
}
22 changes: 6 additions & 16 deletions src/VirtualClient/Module.props
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,19 @@
<Microsoft_Diagnostics_Tracing_TraceEvent_PackageVersion>2.0.61</Microsoft_Diagnostics_Tracing_TraceEvent_PackageVersion>

<!-- Microsoft.Extensions.Configuration -->
<Microsoft_Extensions_Configuration_PackageVersion>7.0.0</Microsoft_Extensions_Configuration_PackageVersion>
<Microsoft_Extensions_Configuration_PackageVersion>8.0.0</Microsoft_Extensions_Configuration_PackageVersion>

<!-- Microsoft.Extensions.Configuration.Json -->
<Microsoft_Extensions_Configuration_Json_PackageVersion>7.0.0</Microsoft_Extensions_Configuration_Json_PackageVersion>
<Microsoft_Extensions_Configuration_Json_PackageVersion>8.0.0</Microsoft_Extensions_Configuration_Json_PackageVersion>

<!-- Microsoft.Extensions.DependencyInjection -->
<Microsoft_Extensions_DependencyInjection_PackageVersion>7.0.0</Microsoft_Extensions_DependencyInjection_PackageVersion>
<Microsoft_Extensions_DependencyInjection_PackageVersion>8.0.0</Microsoft_Extensions_DependencyInjection_PackageVersion>

<!-- Microsoft.Extensions.Logging -->
<Microsoft_Extensions_Logging_PackageVersion>7.0.0</Microsoft_Extensions_Logging_PackageVersion>
<Microsoft_Extensions_Logging_PackageVersion>8.0.0</Microsoft_Extensions_Logging_PackageVersion>

<!-- Microsoft.Extensions.Logging.Console -->
<Microsoft_Extensions_Logging_Console_PackageVersion>7.0.0</Microsoft_Extensions_Logging_Console_PackageVersion>
<Microsoft_Extensions_Logging_Console_PackageVersion>8.0.0</Microsoft_Extensions_Logging_Console_PackageVersion>

<!-- Microsoft.NET.Test.Sdk -->
<Microsoft_NET_Test_Sdk_PackageVersion>17.0.0</Microsoft_NET_Test_Sdk_PackageVersion>
Expand Down Expand Up @@ -156,7 +156,7 @@
<System_Net_NameResolution_PackageVersion>4.3.0</System_Net_NameResolution_PackageVersion>

<!-- System.Reflection.Metadata -->
<System_Reflection_Metadata_PackageVersion>6.0.0</System_Reflection_Metadata_PackageVersion>
<System_Reflection_Metadata_PackageVersion>8.0.0</System_Reflection_Metadata_PackageVersion>

<!-- System.Security.Principal.Windows -->
<System_Security_Principal_Windows_PackageVersion>5.0.0</System_Security_Principal_Windows_PackageVersion>
Expand All @@ -166,16 +166,6 @@

</PropertyGroup>

<!--
*****************************************************************************
Ensure the target .NET Core runtime is explicitly defined to avoid issues
between NuGet package restores and build.
*****************************************************************************
-->
<PropertyGroup Condition="'$(TargetFramework)' == 'net6.0'">
<RuntimeFrameworkVersion>6.0.14</RuntimeFrameworkVersion>
</PropertyGroup>

<!--
******************************************************************************

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
<RunCodeAnalysis>false</RunCodeAnalysis>
<RunAnalyzers>true</RunAnalyzers>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Copyright (C) Microsoft Corporation. All rights reserved.
/home/anyuser/vc/packages/aspnetbenchmarks/src/Benchmarks/Benchmarks.csproj : warning NU1604: Project dependency Microsoft.AspNetCore.Mvc.NewtonsoftJson does not contain an inclusive lower bound. Include a lower bound in the dependency version to ensure consistent restore results.
Restored /home/anyuser/vc/packages/aspnetbenchmarks/src/Benchmarks/Benchmarks.csproj (in 837 ms).
/home/anyuser/vc/packages/aspnetbenchmarks/src/Benchmarks/Benchmarks.csproj : warning NU1604: Project dependency Microsoft.AspNetCore.Mvc.NewtonsoftJson does not contain an inclusive lower bound. Include a lower bound in the dependency version to ensure consistent restore results.
Benchmarks -> /home/anyuser/vc/packages/aspnetbenchmarks/src/Benchmarks/bin/Release/net6.0/Benchmarks.dll
Benchmarks -> /home/anyuser/vc/packages/aspnetbenchmarks/src/Benchmarks/bin/Release/net8.0/Benchmarks.dll

Build succeeded.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
<RunCodeAnalysis>false</RunCodeAnalysis>
<RunAnalyzers>false</RunAnalyzers>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,13 @@ await this.systemManagement.MakeFileExecutableAsync(this.bombardierFilePath, thi

this.dotnetExePath = this.Combine(dotnetSdkPackage.Path, this.Platform == PlatformID.Unix ? "dotnet" : "dotnet.exe");

// ~/vc/packages/dotnet/dotnet build -c Release -p:BenchmarksTargetFramework=net6.0
// ~/vc/packages/dotnet/dotnet build -c Release -p:BenchmarksTargetFramework=net8.0
// Build the aspnetbenchmark project
string buildArgument = $"build -c Release -p:BenchmarksTargetFramework={this.TargetFramework}";
await this.ExecuteCommandAsync(this.dotnetExePath, buildArgument, this.aspnetBenchDirectory, cancellationToken)
.ConfigureAwait(false);

// "C:\Users\vcvmadmin\Benchmarks\src\Benchmarks\bin\Release\net6.0\Benchmarks.dll"
// "C:\Users\vcvmadmin\Benchmarks\src\Benchmarks\bin\Release\net8.0\Benchmarks.dll"
this.aspnetBenchDllPath = this.Combine(
this.aspnetBenchDirectory,
"bin",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<AssemblyName>VirtualClient.Actions</AssemblyName>
<NoWarn>SA1508;CA1416;CS4014;CA2213</NoWarn>
<NoWarn>SA1508;CA1416;CS4014;CA2213;IL2026</NoWarn>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
<RunCodeAnalysis>false</RunCodeAnalysis>
<RunAnalyzers>false</RunAnalyzers>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<AssemblyName>VirtualClient.Api</AssemblyName>
<RootNamespace>VirtualClient.Api</RootNamespace>
<NoWarn>AD0001,SA1508</NoWarn>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
<RootNamespace>VirtualClient.Common</RootNamespace>
<NoWarn>CA1001</NoWarn>
Expand Down
11 changes: 0 additions & 11 deletions src/VirtualClient/VirtualClient.Common/Rest/RestException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,5 @@ public RestException(string message, Exception innerException)
: base(message, innerException)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="RestException"/> class with
/// the provided serialization and context information.
/// </summary>
/// <param name="info">The serialization information.</param>
/// <param name="context">The streaming context.</param>
protected RestException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public override bool CanConvert(Type objectType)
if (objectType != null && !objectType.IsPrimitive && objectType.IsGenericType)
{
canConvert = objectType == ContextPropertiesJsonConverter.supportedType
|| objectType.GetInterfaces().Contains(ContextPropertiesJsonConverter.supportedType);
|| ContextPropertiesJsonConverter.supportedType.IsAssignableFrom(objectType);
}

return canConvert;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<AssemblyName>VirtualClient.Common</AssemblyName>
<NoWarn></NoWarn>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
<RunCodeAnalysis>false</RunCodeAnalysis>
<RunAnalyzers>false</RunAnalyzers>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ namespace VirtualClient.Contracts
{
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
Expand Down Expand Up @@ -120,7 +121,7 @@ public static VirtualClientComponent CreateComponent(IDictionary<string, IConver
}
}

private static VirtualClientComponent CreateComponent(ExecutionProfileElement componentDescription, Type type, IServiceCollection dependencies, int? randomizationSeed = null)
private static VirtualClientComponent CreateComponent(ExecutionProfileElement componentDescription, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type type, IServiceCollection dependencies, int? randomizationSeed = null)
{
VirtualClientComponent component = null;
if (componentDescription.Components?.Any() != true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ namespace VirtualClient.Contracts
{
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Reflection;
Expand Down Expand Up @@ -71,7 +72,7 @@ public void LoadComponentTypes(string assemblyDirectory)
/// <returns>
/// True if a matching component exists in the type cache.
/// </returns>
public bool TryGetComponentType(string componentType, out Type type)
public bool TryGetComponentType(string componentType, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] out Type type)
{
componentType.ThrowIfNullOrWhiteSpace(nameof(componentType));
type = this.FirstOrDefault(type => type.FullName == componentType || type.Name == componentType)?.Type;
Expand Down Expand Up @@ -143,7 +144,7 @@ public class ComponentType
/// <summary>
/// Initializes a new instance of the <see cref="ComponentType"/> class.
/// </summary>
public ComponentType(Type type)
public ComponentType([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type type)
{
type.ThrowIfNull(nameof(type));
this.Type = type;
Expand Down Expand Up @@ -174,6 +175,7 @@ public string FullName
/// <summary>
/// The component type.
/// </summary>
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)]
public Type Type { get; }
}
}
Loading