Skip to content
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

[VMR] aspnetcore packages produced in VMR have incorrect prerelease versioning #4895

Closed
NikolaMilosavljevic opened this issue Feb 11, 2025 · 3 comments · Fixed by dotnet/aspnetcore#60457

Comments

@NikolaMilosavljevic
Copy link
Member

This could be the case with repo produced packages as well - to be investigated.

For the repro build I've used this command: ./build.sh -t --ci --online /p:CrossBuild=true /p:TargetOS=linux /p:TargetArchitecture=x64 /bl
Docker container and command:

Here's a comparison of versioning for package and dependencies when prerelease versioning is used, i.e. ci. Notice a difference between - and ~.

Aspnet runtime:

 Package: aspnetcore-runtime-10.0
 Version: 10.0.0~
 Depends: dotnet-runtime-10.0 (>= 10.0.0-ci)
 Description: Microsoft.AspNetCore.App.Runtime 10.0.0~

SDK:

 Package: dotnet-sdk-10.0
 Version: 10.0.100~ci
 Depends: dotnet-runtime-10.0 (>= 10.0.0~ci), dotnet-targeting-pack-10.0 (>= 10.0.0~ci), dotnet-apphost-pack-10.0 (>= 10.0.0~ci), netstandard-targeting-pack-2.1 (>= 2.1.0), aspnetcore-runtime-10.0 (>= 10.0.0~ci), aspnetcore-targeting-pack-10.0 (>= 10.0.0~ci)
 Description: Microsoft .NET SDK 10.0.100-ci

Runtime:

 Package: dotnet-runtime-10.0
 Version: 10.0.0~ci
 Depends: dotnet-hostfxr-10.0 (>= 10.0.0~ci), dotnet-runtime-deps-10.0 (>= 10.0.0~ci)
 Description: Microsoft.NETCore.App.Runtime.CoreCLR 10.0.0~ci

As a result, aspnetcore-runtime package cannot be installed with missing dependency error:

dpkg: dependency problems prevent configuration of aspnetcore-runtime-10.0:
 aspnetcore-runtime-10.0 depends on dotnet-runtime-10.0 (>= 10.0.0-ci); however:
  Version of dotnet-runtime-10.0 on system is 10.0.0~ci.

User can force the installation using --force-all or similar dpkg option.

@NikolaMilosavljevic
Copy link
Member Author

I've found the root cause, but I'm not sure what is the best option for a fix as it is related to the order of importing of Arcade SDK targets.

The issue is that arcade SDK targets are imported late, so VersionSuffix is evaluated after we've consumed the property in arcade's Installers targets: https://github.com/dotnet/arcade/blob/00ea5e3e83ae9d9f73a5b959fd745e5092be6d0b/src/Microsoft.DotNet.Build.Tasks.Installers/build/installer.build.targets#L36

This is all caused by an override of CustomBeforeMicrosoftCommonTargets in https://github.com/dotnet/aspnetcore/blob/9c410aaf1ef3db65374bf237589ae8bc6910d37c/Directory.Build.props#L282

Property reassignment: $(CustomBeforeMicrosoftCommonTargets)="/src/git/aspnetcore/Directory.Build.BeforeCommonTargets.targets" (previous value: "/src/git/aspnetcore/.packages/microsoft.dotnet.arcade.sdk/10.0.0-beta.25067.3/tools/BeforeCommonTargets.targets") at /src/git/aspnetcore/Directory.Build.props (282,5)

There are no such overrides in runtime or sdk so we do not see this issue.

I think the following might be the options:

  1. Modify https://github.com/dotnet/aspnetcore/blob/main/Directory.Build.BeforeCommonTargets.targets to import arcade SDK targets (BeforeCommonTargets.targets) at the end of this file - maybe just for installer projects.
  2. Import arcade sdk targets (BeforeCommonTargets.targets) directly, in installer projects, i.e.https://github.com/dotnet/aspnetcore/blob/main/src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.sfxproj

@mmitche @jkoritzinsky @ViktorHofer

@ViktorHofer
Copy link
Member

ViktorHofer commented Feb 14, 2025

Yes, those two overrides are wrong: https://github.com/dotnet/aspnetcore/blob/9c410aaf1ef3db65374bf237589ae8bc6910d37c/Directory.Build.props#L282-L283

They should append to the property, not overwrite it, i.e. <CustomBeforeMicrosoftCommonTargets>$(CustomBeforeMicrosoftCommonTargets);...</CustomBeforeMicrosoftCommonTargets>

@NikolaMilosavljevic
Copy link
Member Author

Yes, those two overrides are wrong: https://github.com/dotnet/aspnetcore/blob/9c410aaf1ef3db65374bf237589ae8bc6910d37c/Directory.Build.props#L282-L283

They should append to the property, not overwrite it, i.e. <CustomBeforeMicrosoftCommonTargets>$(CustomBeforeMicrosoftCommonTargets);...</CustomBeforeMicrosoftCommonTargets>

Thanks.

I think they intentionally want their targets file to be imported before arcade SDK, so I'll keep theirs first and append the current property value:

  <PropertyGroup>
    <!-- Set the arcade before common targets so we compute ExcludeFromBuild before arcade uses it. -->
    <CustomBeforeMicrosoftCommonTargets>$(MSBuildThisFileDirectory)Directory.Build.BeforeCommonTargets.targets;$(CustomBeforeMicrosoftCommonTargets)</CustomBeforeMicrosoftCommonTargets>
    <CustomBeforeMicrosoftCommonCrossTargetingTargets>$(MSBuildThisFileDirectory)Directory.Build.BeforeCommonTargets.targets;$(CustomBeforeMicrosoftCommonCrossTargetingTargets)</CustomBeforeMicrosoftCommonCrossTargetingTargets>
  </PropertyGroup>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants