-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Build error NETSDK1124 with NET8 RC2 when multiple TargetFrameworks #94406
Comments
Tagging subscribers to this area: @dotnet/area-infrastructure-libraries Issue DetailsDescriptionTrying to publish an application
The application depends on two libraries:
The build fails with the following error:
Reproduction StepsPublish NET8 application with trimming, that depends on projects with mutiple Expected behaviorBuild publishes the application without errors. Actual behaviorBuild fails with Regression?Build works fine with NET6 + NET7 Known WorkaroundsUninstall NET8 RC2 SDK ConfigurationNo response Other informationNo response
|
@ViktorHofer Curious why this is moved to |
Was able to publish without build-errors by adding
|
Hrm adding |
Tagging subscribers to this area: @dotnet/area-infrastructure-libraries Issue DetailsDescriptionTrying to publish an application
The application depends on two libraries:
The build fails with the following error:
Reproduction StepsPublish NET8 application with trimming, that depends on projects with mutiple Also tried to update library-projects to be very explicit about when to enable trimming, but build with publish still fails (No warnings or errors with standard
Also tried adding these command-line options Expected behaviorBuild publishes the application without errors. Actual behaviorBuild fails with Regression?Build publish with trimming works fine with NET6 + NET7 Known WorkaroundsUninstall NET8 RC2 SDK or stop using multiple TargetFrameworks in library-projects or depend on nuget-packages instead of the library-projects directly. ConfigurationNo response Other informationNo response
|
Good point. I just moved the issue back. cc @agocke |
I am seeing similiar error on |
cc @vitek-karas |
@snakefoot, could you please try adding There is a somewhat unexpected MSBuild behavior where all properties passed on the command line are forced onto all projects (even dependencies), and /cc @sbomer |
Yes moving Combined with adding |
My problem is also resolved for two Docker builds (alpine and debian based) with trimming enabled - now only in top-most *.csproj I am having |
Our guidance is to put the
@sbomer - can we raise this again with the SDK/MSBuild people, to see if we can make progress on it? Originally it was just a quirk we found internally, but this indicates people are running into it. |
I'll check with MSBuild folks again. Last time we asked, there were two possible fixes:
I think both of those solutions are worse than the original problem. It sounds like moving |
I think the current build-error message is a little confusing:
When the solution involves removing |
The problem is that the error was never meant to be triggered by |
Another way to easily handle this in the project file is to use a condition: <PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net7.0'))">
<PublishTrimmed>true</PublishTrimmed>
</PropertyGroup> |
Description
Trying to publish an application
<TargetFramework>net8.0</TargetFramework>
with trimming enabled:The application depends on two libraries:
The build fails with the following error:
Reproduction Steps
Publish NET8 application with trimming, that depends on projects with mutiple
<TargetFrameworks>
(Besides NET8)Also tried to update library-projects to be very explicit about when to enable trimming, but build with publish still fails (No warnings or errors with standard
dotnet build
):Also tried adding these command-line options
-f net8.0
or-p:TargetFramework=net8.0
, but the build-error remains.Expected behavior
Build publishes the application without errors.
Actual behavior
Build fails with
error NETSDK1124: Trimming assemblies requires .NET Core 3.0 or higher.
for the library projects.Regression?
Build publish with trimming works fine with NET6 + NET7
Known Workarounds
Uninstall NET8 RC2 SDK or stop using multiple TargetFrameworks in library-projects or depend on nuget-packages instead of the library-projects directly.
Configuration
No response
Other information
No response
The text was updated successfully, but these errors were encountered: