Skip to content

Update the nuget and microsoft extensions packages #8864

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

Merged
merged 3 commits into from
Apr 7, 2025

Conversation

marcpopMSFT
Copy link
Member

Problem

Tooling has identified old packages being downloaded during the build. They aren't used in the SDK itself but we should get clean on CG

@marcpopMSFT marcpopMSFT requested a review from a team as a code owner March 26, 2025 20:51
@marcpopMSFT
Copy link
Member Author

@dotnet/source-build I updated to the versions that the SDK is using for these packages. Do I have to add all of them to the version.details.xml now?

@mthalman
Copy link
Member

@dotnet/source-build I updated to the versions that the SDK is using for these packages. Do I have to add all of them to the version.details.xml now?

The NuGet prebuilts will need to be added to SBRP (in the 9.0 branch). The others can be added to the prebuilt baseline.

@Forgind
Copy link
Member

Forgind commented Apr 2, 2025

@dotnet/source-build I updated to the versions that the SDK is using for these packages. Do I have to add all of them to the version.details.xml now?

The NuGet prebuilts will need to be added to SBRP (in the 9.0 branch). The others can be added to the prebuilt baseline.

Did anyone do this?

@marcpopMSFT
Copy link
Member Author

@mthalman would adding them to the version.details.xml also work? I went ahead and added nuget here: dotnet/source-build-reference-packages#1216

The rest I should add to the prebuilt exclusion list?

@mthalman
Copy link
Member

mthalman commented Apr 7, 2025

@mthalman would adding them to the version.details.xml also work?

No, because the VMR isn't configured for the templating repo to depend on the nuget-client repo. So regardless of how version.details.xml is defined, there's no live version of nuget to flow in. That's why it needs to be defined in SBRP.

The rest I should add to the prebuilt exclusion list?

Yes

@marcpopMSFT
Copy link
Member Author

@mthalman ok, updated the SBRP version and added the prebuilt exclusions. Hopefully the source build leg passes. Why wasn't adding the runtime entries in version.details.xml enough to avoid the prebuilt exclusions?

@marcpopMSFT marcpopMSFT merged commit 7fa9bf9 into release/9.0.1xx Apr 7, 2025
10 checks passed
@ViktorHofer ViktorHofer deleted the marcpopMSFT-updatepackages branch April 16, 2025 22:58
@ViktorHofer
Copy link
Member

ViktorHofer commented Apr 16, 2025

@marcpopMSFT this PR has regressed the templating msbuild tasks when being loaded on desktop msbuild. Here's an isolated repro:

app.csproj

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net9.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    <LocalizeTemplates>true</LocalizeTemplates>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.TemplateEngine.Authoring.Tasks" Version="10.0.100-preview.4.25215.8" />
  </ItemGroup>

</Project>

Program.cs

// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");

From a developer command prompt on Windows: msbuild /restore app.csproj:

"C:\temp\templmsbuild\templmsbuild.csproj" (default target) (1:7) ->
(LocalizeTemplatesAfterBuild target) ->
C:\Users\vihofer.nuget\packages\microsoft.templateengine.authoring.tasks\10.0.100-preview.4.25215.8\build\Microsoft.
TemplateEngine.Authoring.Tasks.targets(14,5): error MSB4018: The "LocalizeTemplates" task failed unexpectedly. [C:\temp
\templmsbuild\templmsbuild.csproj]
C:\Users\vihofer.nuget\packages\microsoft.templateengine.authoring.tasks\10.0.100-preview.4.25215.8\build\Microsoft.Te
mplateEngine.Authoring.Tasks.targets(14,5): error MSB4018: System.IO.FileNotFoundException->Microsoft.Build.Framework.B
uildException.GenericBuildTransferredException: Could not load file or assembly 'Microsoft.Extensions.Logging.Abstracti
ons, Version=9.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The system cannot f
ind the file specified. [C:\temp\templmsbuild\templmsbuild.csproj]

@ViktorHofer
Copy link
Member

This is due to libraries in this repo referencing the 9.0.0.0 version of the Microsoft.Extensions.* assemblies but the 9.0.0.3 versioned assemblies being available in the tools folder. That would require binding redirects which a netfx msbuild task can't provide

The overall issue here is that the TFMs in this repo are inconsistent. The msbuild task targets net472 but its dependencies target net481 so the netstandard2.0 TFMs are resolved instead which have the wrong assembly version of Microsoft.Extensions* dependencies and would require binding redirects.

I will submit a PR to fix this.

ViktorHofer added a commit that referenced this pull request Apr 16, 2025
... due to inconsistent TFMs. See #8864 (comment) for more details
@ViktorHofer
Copy link
Member

Submitted #8952

ViktorHofer added a commit that referenced this pull request Apr 17, 2025
* Fix tasks not loading on .NET Framework

... due to inconsistent TFMs. See #8864 (comment) for more details

* Fix TFMs and set NetFrameworkMinimum to net472

* Build NetCurrent in source-only builds
ViktorHofer added a commit that referenced this pull request Apr 17, 2025
* Fix tasks not loading on .NET Framework

... due to inconsistent TFMs. See #8864 (comment) for more details

* Fix TFMs and set NetFrameworkMinimum to net472

* Build NetCurrent in source-only builds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants