-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Regression - NET8 Preview1 SDK won't publish trimmed self contained solution with netstandard2.1 projects #30948
Comments
I stumbled on the same issue when trying to add .NET 8 support in Serilog. Here is a simple reproduction. Issue30948.csproj: <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.1;net461;net8.0</TargetFrameworks>
<IsTrimmable>true</IsTrimmable>
</PropertyGroup>
</Project>
Does it mean that |
@dotnet/illink-contrib a new issue has been filed in the ILLink area, please triage |
Closing this as expected since trimming isn't a supported scenario for netstandard2.1 libraries - see dotnet/runtime#86924. Note that the warning message has improved, so you should now get:
The recommendation is to multi-target the library to at least net6.0 instead, and avoid setting |
Re-opening this to track adding a breaking change notice about the new warning. |
Context: dotnet/sdk#30948 Building with VS 2022 17.8 Preview 1, I get the error: C:\Program Files\dotnet\sdk\8.0.100-preview.7.23376.3\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(90,5): error NETSDK1195: Trimming, or code compatibility analysis for trimming, single-file deployment, or ahead-of-time compilation is not supported for the target framework. For more information, see https://aka.ms/netsdk1195 It appears there is a new build warning if you set `IsTrimmable=true` in a `netstandard` project. For now, this doesn't really matter to MAUI as these projects only *really* need to be trimmable for mobilie. `net8.0-android`, `net8.0-ios`, etc. projects can remain trimmable if we add a condition: <IsTrimmable Condition="!$(TargetFramework.StartsWith('netstandard'))">true</IsTrimmable>
Context: dotnet/sdk#30948 Building with VS 2022 17.8 Preview 1, I get the error: C:\Program Files\dotnet\sdk\8.0.100-preview.7.23376.3\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(90,5): error NETSDK1195: Trimming, or code compatibility analysis for trimming, single-file deployment, or ahead-of-time compilation is not supported for the target framework. For more information, see https://aka.ms/netsdk1195 It appears there is a new build warning if you set `IsTrimmable=true` in a `netstandard` project. For now, this doesn't really matter to MAUI as these projects only *really* need to be trimmable for mobilie. `net8.0-android`, `net8.0-ios`, etc. projects can remain trimmable if we add a condition: <IsTrimmable Condition="!$(TargetFramework.StartsWith('netstandard'))">true</IsTrimmable>
Context: dotnet/sdk#30948 Building with VS 2022 17.8 Preview 1, I get the error: C:\Program Files\dotnet\sdk\8.0.100-preview.7.23376.3\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(90,5): error NETSDK1195: Trimming, or code compatibility analysis for trimming, single-file deployment, or ahead-of-time compilation is not supported for the target framework. For more information, see https://aka.ms/netsdk1195 It appears there is a new build warning if you set `IsTrimmable=true` in a `netstandard` project. For now, this doesn't really matter to MAUI as these projects only *really* need to be trimmable for mobilie. `net8.0-android`, `net8.0-ios`, etc. projects can remain trimmable if we add a condition: <IsTrimmable Condition="!$(TargetFramework.StartsWith('netstandard'))">true</IsTrimmable>
I have project with reference to netstandard2.1 class libraries. When I try to publish it, it ends up in error:
error NETSDK1195: Unable to optimize assemblies for size: a valid runtime package was not found. Either set the PublishTrimmed property to false, or use a supported target framework when publishing.
The text was updated successfully, but these errors were encountered: