Skip to content

Commit

Permalink
Add net8.0 to SDK v7.0
Browse files Browse the repository at this point in the history
- Add net8.0 to TargetFrameworks of C# projects
- Add net8.0 binaries to NuGet projects
- Change tests from net6.0 to net8.0
- Increase HttpSys reference to 2.1.12 to fix security vulnerability reported as build error
- Make tests define RequestDelegate with correct return type to fix net8.0 build error
- Increment internal package version for integration

https://dev.azure.com/msazure/One/_workitems/edit/27099154
  • Loading branch information
olegsych committed Mar 26, 2024
2 parents 582d155 + 6cba8fa commit 95b2956
Show file tree
Hide file tree
Showing 14 changed files with 81 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@
<File Include="$(DropFolderNet7)Microsoft.ServiceFabric.AspNetCore.dll">
<TargetPath>lib\net7.0</TargetPath>
</File>
<File Include="$(DropFolderNet8)Microsoft.ServiceFabric.AspNetCore.xml">
<TargetPath>lib\net8.0</TargetPath>
</File>
<File Include="$(DropFolderNet8)Microsoft.ServiceFabric.AspNetCore.dll">
<TargetPath>lib\net8.0</TargetPath>
</File>
<File Include="$(DropFolderNetFramework)Microsoft.ServiceFabric.AspNetCore.dll">
<TargetPath>runtimes\win\lib\net461</TargetPath>
</File>
Expand Down Expand Up @@ -119,6 +125,14 @@
<TargetFramework>net7.0</TargetFramework>
</FrameworkReference>

<Dependency Include="Microsoft.ServiceFabric.Services">
<Version>[$(NugetPkg_Version_Microsoft_ServiceFabric_Services)]</Version>
<TargetFramework>net8.0</TargetFramework>
</Dependency>
<FrameworkReference Include="Microsoft.AspNetCore.App">
<TargetFramework>net8.0</TargetFramework>
</FrameworkReference>

<Dependency Include="Microsoft.ServiceFabric.Services">
<Version>[$(NugetPkg_Version_Microsoft_ServiceFabric_Services)]</Version>
<TargetFramework>net461</TargetFramework>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@
<File Include="$(DropFolderNet7)Microsoft.ServiceFabric.AspNetCore.Configuration.xml">
<TargetPath>lib\net7.0</TargetPath>
</File>
<File Include="$(DropFolderNet8)Microsoft.ServiceFabric.AspNetCore.Configuration.dll">
<TargetPath>lib\net8.0</TargetPath>
</File>
<File Include="$(DropFolderNet8)Microsoft.ServiceFabric.AspNetCore.Configuration.xml">
<TargetPath>lib\net8.0</TargetPath>
</File>
<File Include="$(DropFolderNetFramework)Microsoft.ServiceFabric.AspNetCore.Configuration.dll">
<TargetPath>runtimes\win\lib\net461</TargetPath>
</File>
Expand Down Expand Up @@ -119,6 +125,14 @@
<TargetFramework>net7.0</TargetFramework>
</FrameworkReference>

<Dependency Include="Microsoft.ServiceFabric.Services">
<Version>[$(NugetPkg_Version_Microsoft_ServiceFabric_Services)]</Version>
<TargetFramework>net8.0</TargetFramework>
</Dependency>
<FrameworkReference Include="Microsoft.AspNetCore.App">
<TargetFramework>net8.0</TargetFramework>
</FrameworkReference>

<Dependency Include="Microsoft.ServiceFabric.Services">
<Version>[$(NugetPkg_Version_Microsoft_ServiceFabric_Services)]</Version>
<TargetFramework>net461</TargetFramework>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@
<File Include="$(DropFolderNet7)Microsoft.ServiceFabric.AspNetCore.HttpSys.xml">
<TargetPath>lib\net7.0</TargetPath>
</File>
<File Include="$(DropFolderNet8)Microsoft.ServiceFabric.AspNetCore.HttpSys.dll">
<TargetPath>lib\net8.0</TargetPath>
</File>
<File Include="$(DropFolderNet8)Microsoft.ServiceFabric.AspNetCore.HttpSys.xml">
<TargetPath>lib\net8.0</TargetPath>
</File>
<File Include="$(DropFolderNetFramework)Microsoft.ServiceFabric.AspNetCore.HttpSys.dll">
<TargetPath>runtimes\win\lib\net461</TargetPath>
</File>
Expand Down Expand Up @@ -119,12 +125,20 @@
<TargetFramework>net7.0</TargetFramework>
</FrameworkReference>

<Dependency Include="Microsoft.ServiceFabric.AspNetCore.Abstractions">
<Version>[$(NuGetPackageVersion)]</Version>
<TargetFramework>net8.0</TargetFramework>
</Dependency>
<FrameworkReference Include="Microsoft.AspNetCore.App">
<TargetFramework>net8.0</TargetFramework>
</FrameworkReference>

<Dependency Include="Microsoft.ServiceFabric.AspNetCore.Abstractions">
<Version>[$(NuGetPackageVersion)]</Version>
<TargetFramework>net461</TargetFramework>
</Dependency>
<Dependency Include="Microsoft.AspNetCore.Server.HttpSys">
<Version>2.1.0</Version>
<Version>2.1.12</Version>
<TargetFramework>net461</TargetFramework>
</Dependency>
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@
<File Include="$(DropFolderNet7)Microsoft.ServiceFabric.AspNetCore.Kestrel.xml">
<TargetPath>lib\net7.0</TargetPath>
</File>
<File Include="$(DropFolderNet8)Microsoft.ServiceFabric.AspNetCore.Kestrel.dll">
<TargetPath>lib\net8.0</TargetPath>
</File>
<File Include="$(DropFolderNet8)Microsoft.ServiceFabric.AspNetCore.Kestrel.xml">
<TargetPath>lib\net8.0</TargetPath>
</File>
<File Include="$(DropFolderNetFramework)Microsoft.ServiceFabric.AspNetCore.Kestrel.dll">
<TargetPath>runtimes\win\lib\net461</TargetPath>
</File>
Expand Down Expand Up @@ -119,6 +125,14 @@
<TargetFramework>net7.0</TargetFramework>
</FrameworkReference>

<Dependency Include="Microsoft.ServiceFabric.AspNetCore.Abstractions">
<Version>[$(NuGetPackageVersion)]</Version>
<TargetFramework>net8.0</TargetFramework>
</Dependency>
<FrameworkReference Include="Microsoft.AspNetCore.App">
<TargetFramework>net8.0</TargetFramework>
</FrameworkReference>

<Dependency Include="Microsoft.ServiceFabric.AspNetCore.Abstractions">
<Version>[$(NuGetPackageVersion)]</Version>
<TargetFramework>net461</TargetFramework>
Expand Down
3 changes: 3 additions & 0 deletions nuprojs/SF.AspNetCore.Internal/SF.AspNetCore.Internal.nuproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,8 @@
<File Include="$(DropFolderNet7)*.*">
<TargetPath>lib\net7.0</TargetPath>
</File>
<File Include="$(DropFolderNet8)*.*">
<TargetPath>lib\net8.0</TargetPath>
</File>
</ItemGroup>
</Project>
3 changes: 2 additions & 1 deletion properties/service_fabric_common.props
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<DropFolderNet5>$(RepoRoot)drop\$(Configuration)\net5.0\</DropFolderNet5>
<DropFolderNet6>$(RepoRoot)drop\$(Configuration)\net6.0\</DropFolderNet6>
<DropFolderNet7>$(RepoRoot)drop\$(Configuration)\net7.0\</DropFolderNet7>
<DropFolderNet8>$(RepoRoot)drop\$(Configuration)\net8.0\</DropFolderNet8>
<NugetPackageDropFolder>$(DropFolder)\packages</NugetPackageDropFolder>

<!-- Set Nuget exe path -->
Expand All @@ -30,7 +31,7 @@
<!-- TODO: Versions numbers are changed here manually for now, Integrate this with GitVersion. -->
<MajorVersion>7</MajorVersion>
<MinorVersion>0</MinorVersion>
<BuildVersion>2</BuildVersion>
<BuildVersion>3</BuildVersion>
<Revision>0</Revision>

</PropertyGroup>
Expand Down
8 changes: 8 additions & 0 deletions properties/service_fabric_managed.targets
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,14 @@
<BinariesNet7 Include="src\Microsoft.ServiceFabric.AspNetCore.Kestrel\$(OutputPath)net7.0\Microsoft.ServiceFabric.AspNetCore.Kestrel.*"/>
</ItemGroup>
<Copy SourceFiles="@(BinariesNet7)" DestinationFiles="@(BinariesNet7->'$(DropFolderNet7)\%(Destination)\%(RecursiveDir)%(Filename)%(Extension)')" />

<ItemGroup>
<BinariesNet8 Include="src\Microsoft.ServiceFabric.AspNetCore\$(OutputPath)net8.0\Microsoft.ServiceFabric.AspNetCore.*"/>
<BinariesNet8 Include="src\Microsoft.ServiceFabric.AspNetCore.Configuration\$(OutputPath)net8.0\Microsoft.ServiceFabric.AspNetCore.Configuration.*"/>
<BinariesNet8 Include="src\Microsoft.ServiceFabric.AspNetCore.HttpSys\$(OutputPath)net8.0\Microsoft.ServiceFabric.AspNetCore.HttpSys.*"/>
<BinariesNet8 Include="src\Microsoft.ServiceFabric.AspNetCore.Kestrel\$(OutputPath)net8.0\Microsoft.ServiceFabric.AspNetCore.Kestrel.*"/>
</ItemGroup>
<Copy SourceFiles="@(BinariesNet8)" DestinationFiles="@(BinariesNet8->'$(DropFolderNet8)\%(Destination)\%(RecursiveDir)%(Filename)%(Extension)')" />
</Target>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<AssemblyName>Microsoft.ServiceFabric.AspNetCore.Configuration</AssemblyName>
<RootNamespace>Microsoft.ServiceFabric.AspNetCore.Configuration</RootNamespace>
<DocumentationFile>$(OutputPath)\$(AssemblyName).xml</DocumentationFile>
<TargetFrameworks>net461;netcoreapp3.1;net5.0;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net461;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.ServiceFabric.Services" Version="$(NugetPkg_Version_Microsoft_ServiceFabric_Services)" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<RootNamespace>Microsoft.ServiceFabric.Services.Communication.AspNetCore</RootNamespace>
<AssemblyName>Microsoft.ServiceFabric.AspNetCore.HttpSys</AssemblyName>
<DocumentationFile>$(OutputPath)\$(AssemblyName).xml</DocumentationFile>
<TargetFrameworks>net461;netcoreapp3.1;net5.0;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net461;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.ServiceFabric" Version="$(NugetPkg_Version_Microsoft_ServiceFabric)" />
Expand All @@ -15,7 +15,7 @@
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net461'">
<PackageReference Include="Microsoft.AspNetCore.Server.HttpSys" Version="2.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Server.HttpSys" Version="2.1.12" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Microsoft.ServiceFabric.AspNetCore\Microsoft.ServiceFabric.AspNetCore.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<AssemblyName>Microsoft.ServiceFabric.AspNetCore.Kestrel</AssemblyName>
<RootNamespace>Microsoft.ServiceFabric.Services.Communication.AspNetCore</RootNamespace>
<DocumentationFile>$(OutputPath)\$(AssemblyName).xml</DocumentationFile>
<TargetFrameworks>net461;netcoreapp3.1;net5.0;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net461;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.ServiceFabric" Version="$(NugetPkg_Version_Microsoft_ServiceFabric)" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<AssemblyName>Microsoft.ServiceFabric.AspNetCore</AssemblyName>
<RootNamespace>Microsoft.ServiceFabric.Services.Communication.AspNetCore</RootNamespace>
<DocumentationFile>$(OutputPath)\$(AssemblyName).xml</DocumentationFile>
<TargetFrameworks>net461;netcoreapp3.1;net5.0;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net461;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.ServiceFabric.Services" Version="$(NugetPkg_Version_Microsoft_ServiceFabric_Services)" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<PropertyGroup>
<AssemblyName>Microsoft.ServiceFabric.AspNetCore.Tests</AssemblyName>
<RootNamespace>Microsoft.ServiceFabric.AspNetCore.Tests</RootNamespace>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<DocumentationFile>$(OutputPath)\$(AssemblyName).xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ internal static class TestHelper
public static T CreateInstanced<T>()
where T : class
{
#pragma warning disable SYSLIB0050 // FormatterServices is obsolete
return FormatterServices.GetSafeUninitializedObject(typeof(T)) as T;
#pragma warning restore SYSLIB0050
}

public static T Set<T>(this T instance, string property, object value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void VerifyReturnCode410(string hostType)
(httpContext) =>
{
nextCalled = true;
return Task.FromResult(true);
return Task.CompletedTask;
}, this.listener.UrlSuffix);

// send a request in which Path is different than urlSuffix
Expand Down Expand Up @@ -165,7 +165,7 @@ private void VerifyNextInvocation()
nextCalled = true;
Console.WriteLine("In Next Request Delegate: HttpRequest.Path: " + httpContext.Request.Path);
Console.WriteLine("In Next Request Delegate: HttpRequest.PathBase: " + httpContext.Request.PathBase);
return Task.FromResult(true);
return Task.CompletedTask;
}, this.listener.UrlSuffix);

// send a request in which Path is same as urlSuffix
Expand Down Expand Up @@ -198,7 +198,7 @@ private void VerifyPathsInNextInvocation()
Console.WriteLine("In Next Request Delegate: HttpRequest.PathBase: " + httpContext.Request.PathBase);

nextCalled = true;
return Task.FromResult(true);
return Task.CompletedTask;
}, this.listener.UrlSuffix);

// send a request in which Path is different than urlSuffix, but has extra segment after it.
Expand Down

0 comments on commit 95b2956

Please sign in to comment.