I have an Umbraco (v13.5.2) project (call it project A) which is running fine in ASP.NET Core (.NET 8.0). I have a second project (call it project B) for the controllers which also references the same Umbraco version. The Umbraco packages have been add using the Visual Studio's NuGet Manager and I can see all the common packages between the two projects are the same.
Project A runs fines and does exactly what you'd expect. Project B compiles without issue and can be used, for instance from a console application. But, if I add a project reference in project A to project B, project A fails to run correctly. I get a blank browser page and the only error is in the logs:
{"@t":"2025年01月20日T19:02:25.1073019Z",
"@mt":"Unexpected exception in static IISHttpServer.HandleRequest.",
"@l":"Error",
"@x":"System.MissingMethodException: Method not found: 'System.Nullable`1<System.Net.Security.TlsCipherSuite> Microsoft.AspNetCore.Connections.Features.ITlsHandshakeFeature.get_NegotiatedCipherSuite()'.
at Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer.IISContextFactory`1.CreateHttpContext
at Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer.HandleRequest(IntPtr pInProcessHandler, IntPtr pvRequestContext)",
"SourceContext":"Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer",
"ProcessId":45108,
"ProcessName":"iisexpress",
"ThreadId":21,
"ApplicationId":***
"MachineName":***,
"Log4NetLevel":"ERROR"}
Whilst searching the web provides various suggestions none of the seem to resolve this issue for me. Some suggest that I need to upgrade the Microsoft.AspNetCore.Connections.Abstractions package to the latest version (which is 9.0.1) it is a transitive package currently on 9.0.0 (the slightly newer version was published on the 14th, I had this issue before then i.e. when I was on the latest version). Others suggest it is a versioning issue but all my packages are on the same versions across projects.
Upgrading to Umbraco v15 or .NET9 isn't an option as I'm required to stay on the most recent LTS versions.
I'm at a bit of a loss as to how to fix this. (I thought I had at one point but it was just that I'd removed the reference to project B from project A).
EDIT As request the project files are below.
'Project B'
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<OutputType>Library</OutputType>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Umbraco.Cms.Core" Version="13.5.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Entities\Entities.csproj" />
</ItemGroup>
</Project>
'Project A'
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>My.Umbraco</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Umbraco.Cms" Version="13.5.2" />
</ItemGroup>
<ItemGroup>
<!-- Opt-in to app-local ICU to ensure consistent globalization APIs across different platforms -->
<PackageReference Include="Microsoft.ICU.ICU4C.Runtime" Version="72.1.0.3" />
<ProjectReference Include="..\Controllers\Controllers.csproj" />
<RuntimeHostConfigurationOption Include="System.Globalization.AppLocalIcu" Value="72.1.0.3" Condition="$(RuntimeIdentifier.StartsWith('linux')) or $(RuntimeIdentifier.StartsWith('win')) or ('$(RuntimeIdentifier)' == '' and !$([MSBuild]::IsOSPlatform('osx')))" />
</ItemGroup>
<PropertyGroup>
<!-- Razor files are needed for the backoffice to work correctly -->
<CopyRazorGenerateFilesToPublishDirectory>true</CopyRazorGenerateFilesToPublishDirectory>
</PropertyGroup>
<PropertyGroup>
<!-- Remove RazorCompileOnBuild and RazorCompileOnPublish when not using ModelsMode InMemoryAuto -->
<RazorCompileOnBuild>false</RazorCompileOnBuild>
<RazorCompileOnPublish>false</RazorCompileOnPublish>
</PropertyGroup>
</Project>
-
Can you please share your csproj files?Guru Stron– Guru Stron2025年01月20日 20:10:57 +00:00Commented Jan 20, 2025 at 20:10
-
@GuruStron Added the project files as requestedB_D– B_D2025年01月21日 10:32:59 +00:00Commented Jan 21, 2025 at 10:32
1 Answer 1
This turned out to be nothing to do wiht project B. There was a project C which both B referenced. It was originally a .NET Framework 4.7.2 project and was upgraded to .NET8 using Visual Studio upgrade tool.
Creating a new .NET8 library project and moving the files in along with updating for any required .NET changes resolved the issue.