Skip to content

Remove checked-in nuspec files to resolve build issues#37826

Merged
AndriySvyryd merged 21 commits intomainfrom
copilot/remove-checked-in-nuspec-files
Mar 3, 2026
Merged

Remove checked-in nuspec files to resolve build issues#37826
AndriySvyryd merged 21 commits intomainfrom
copilot/remove-checked-in-nuspec-files

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 2, 2026

Fixes #36254
Fixes #33165

Removes checked-in .nuspec files for dotnet-ef, EFCore.Tools, and EFCore.Tasks and replaces them with MSBuild properties and _PackageFiles targets. This fixes build breaks with newer SDKs where the nuspec files cause NU5000 errors due to missing package type name attributes.

Changes Made

  • Removed src/dotnet-ef/dotnet-ef.nuspec, src/EFCore.Tools/EFCore.Tools.nuspec, src/EFCore.Tasks/EFCore.Tasks.nuspec
  • dotnet-ef.csproj: Replaced NuspecFile/SetPackageProperties with an AddEfProjectOutput target that uses _PackageFiles to include ef.csproj output (dll, exe, pdb, runtimeconfig) at the correct package paths. An ExcludePdbFiles target strips all PDB files from the main package; they are included only in the symbols package
  • EFCore.Tools.csproj: Replaced NuspecFile/SetPackageProperties with an AddPackContent target for lib, tools, psd1, and ef.csproj output (including PDB files). An ExcludePdbFiles target strips PDBs from the main package. Added Microsoft.EntityFrameworkCore.Design as a PackageReference with VersionOverride="8.0.0" for the dependency declaration
  • EFCore.Tasks.csproj: Replaced NuspecFile/SetPackageProperties with an AddPackContent target for lib, tasks, tools, and buildTransitive content. Added a ProjectReference to EFCore.Design with PrivateAssets="all" (for build ordering) and a separate PackageReference with VersionOverride="10.0.0" for the nuspec dependency. Set SuppressDependenciesWhenPacking=true for net472 and Pack=false on .NET Framework References to suppress unwanted dependency groups. Added lib/net10.0/_._ marker file to ensure the package is recognized as targeting net10. ExcludePdbFiles target and eng/CreateSymbolsPackage.targets import for symbols package creation
  • Renamed all PACKAGE.md files to README.md across src/ and test/ directories (22 files) and updated Directory.Build.targets to auto-detect README.md instead of PACKAGE.md
  • eng/CreateSymbolsPackage.targets: Added a shared MSBuild targets file that creates the .symbols.nupkg via a second MSBuild Pack call with _IsSymbolsPack=true. PDB files are included unconditionally in _PackageFiles, and each project has an ExcludePdbFiles target that strips all .pdb files by extension when _IsSymbolsPack != true. This ensures the main package nuspec is generated without PDB references, while the symbols package includes them correctly. Uses $([MSBuild]::NormalizeDirectory(...)) for cross-platform path handling. Imported by dotnet-ef.csproj, EFCore.Tools.csproj, and EFCore.Tasks.csproj
  • EFCore.Analyzers.csproj: Removed explicit PackageReadmeFile property (auto-detected by Directory.Build.targets)
  • Cross-platform paths: All _PackageFiles Include attributes use / instead of \ for filesystem paths to ensure compatibility on non-Windows builds

Package Content Comparison

Package contents were compared before and after the change. Remaining differences are expected SDK behavior changes:

  • README.md location: Package readme now included as README.md at the package root (previously docs/PACKAGE.md)
  • dotnet-ef AppHost: Native dotnet-ef binary no longer in package (SDK explicitly removes AppHost for RID-neutral tool packages per Microsoft.NET.PackTool.targets)
  • Nuspec metadata: exclude="Build,Analyzers" added by SDK on Design dependency (default for PackageReferences); empty .NETFramework4.7.2 dependency group in Tasks (functionally identical to no group)

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits March 2, 2026 22:10
- Remove dotnet-ef.nuspec, EFCore.Tools.nuspec, EFCore.Tasks.nuspec
- Convert package customizations to MSBuild properties and targets
- Add Microsoft.EntityFrameworkCore.Design to Directory.Packages.props
- Use _PackageFiles items in targets to include ef project outputs
- Add PrivateAssets="all" to ef ProjectReference to prevent dependency leakage
- Use ProjectReference to EFCore.Design for Tasks dependency

Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
@AndriySvyryd
Copy link
Copy Markdown
Member

@copilot To validate, compare the content of the affected NuGet before and after the fix, they should match exactly, however, it's acceptable if the versions change to 11.0.0-dev or 11.0.0-dev 3

…ks, add Pack=false to framework refs

Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 2, 2026

@copilot To validate, compare the content of the affected NuGet before and after the fix, they should match exactly, however, it's acceptable if the versions change to 11.0.0-dev or ...

Validated in commit ccbce7a. Comparison summary:

EFCore.Tasks — only PACKAGE.md location change (docs/ → root, new NuGet SDK standard).

EFCore.ToolsPACKAGE.md location + ef.pdb files now also in main package (old nuspec with IncludeSymbols redirected PDBs to symbols-only).

dotnet-efPACKAGE.md location + dotnet-ef native AppHost removed (SDK explicitly removes it for RID-neutral tool packages in Microsoft.NET.PackTool.targets L202) + dotnet-ef.pdb from publish dir + ef.pdb files in main package.

Nuspec metadataexclude="Build,Analyzers" added by SDK default on Design dependency; empty <group targetFramework=".NETFramework4.7.2" /> in Tasks (functionally identical to no group); branch attribute on <repository> (CI artifact). All versions are 11.0.0-dev as expected.

Copilot AI changed the title [WIP] Remove checked-in nuspec files to resolve build issues Remove checked-in nuspec files to resolve build issues Mar 2, 2026
@AndriySvyryd
Copy link
Copy Markdown
Member

@copilot Rename every PACKAGE.md to README.md

Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 2, 2026

@copilot Rename every PACKAGE.md to README.md

Done in b22182a. Renamed all 22 PACKAGE.md files to README.md and updated Directory.Build.targets to auto-detect README.md instead of PACKAGE.md.

Comment thread src/dotnet-ef/dotnet-ef.csproj Outdated
Copilot AI and others added 2 commits March 2, 2026 23:19
Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
Copilot AI and others added 2 commits March 2, 2026 23:48
…nline task

Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
@AndriySvyryd AndriySvyryd requested a review from Copilot March 3, 2026 00:40
@AndriySvyryd AndriySvyryd requested a review from ViktorHofer March 3, 2026 01:47
…version to 10.0.0, remove explicit PackageReadmeFile from Analyzers

Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
@AndriySvyryd AndriySvyryd force-pushed the copilot/remove-checked-in-nuspec-files branch from 0a520ba to b89d49d Compare March 3, 2026 02:35
Copy link
Copy Markdown
Member

@ViktorHofer ViktorHofer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CreateSymbolsPackage.targets stuff looks wrong. Nuget already handles creating symbol packages by default. Can you share more info on why this needed?

@AndriySvyryd
Copy link
Copy Markdown
Member

The default targets include the additional pdbs in the main package. This is needed to only include them in he symbols package.

@ViktorHofer
Copy link
Copy Markdown
Member

ViktorHofer commented Mar 3, 2026

For the default globs, pdbs are already filtered out automatically by NuGet when constructing the "main" package. When you add additionally stuff, you want to condition that on $(IncludeSymbols) and use the defined extension points: https://github.com/dotnet/runtime/blob/39403ad19d1eb4bb57133da1fbc57ab7099ff96a/eng/packaging.targets#L295-L300

@ViktorHofer
Copy link
Copy Markdown
Member

Btw, we should use the officially documented extension points here: https://learn.microsoft.com/en-us/nuget/reference/msbuild-targets#advanced-extension-points-to-create-customized-package. Everything else has couple of issues.

@ViktorHofer
Copy link
Copy Markdown
Member

ViktorHofer commented Mar 3, 2026

Happy to help. I hope pushing a few commits here is OK.

@AndriySvyryd
Copy link
Copy Markdown
Member

Happy to help. I hope pushing a few commits here is OK.

Please go ahead if you can get it to work.

Comment thread src/EFCore.Tools/EFCore.Tools.csproj Outdated
<ItemGroup>
<PackageReference Include="Microsoft.DotNet.Build.Tasks.Templating" PrivateAssets="All" />
<PackageReference Include="Microsoft.DotNet.Build.Tasks.Templating" PrivateAssets="all" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" VersionOverride="8.0.0" />
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AndriySvyryd this change is questionable. What's the intent? Why 8.0.0?

Copy link
Copy Markdown
Member

@ViktorHofer ViktorHofer Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my last commit. I added a stub project that makes referencing the live EFCore.Design work from this project, even though it targets net10.0. This is a hack though. I'm not sure why this design was chosen in the first place.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tools need to work with older versions of EF and 8.0.0 is currently the oldest supported version. Referencing the live one will break support for net8.0 apps, see #37515 (comment)

However, I do realize this is brittle anyway, so #37739 tracks removing it and forcing the user to add this dependency themselves, I just wanted to do it in a separate PR to allow this to be checked in quicker.

Comment thread src/EFCore.Tasks/EFCore.Tasks.csproj Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a change to the current package on nuget.org. Why adding a placeholder file?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For same reason as the .Tools package. But this is also likely going to be removed.

<IncludeSymbols>true</IncludeSymbols>
</PropertyGroup>

<!-- PDBs are currently always included as PackAsTool packages don't support excluding them.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is the reason why I had added the workaround to build the symbols package in the second pass

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not necessary to do anything here. This is the same as the latest released package on nuget.org. When the sdk issue will be adressed, efcore will automatically benefit.

@ViktorHofer
Copy link
Copy Markdown
Member

@AndriySvyryd ready to merge?

@AndriySvyryd
Copy link
Copy Markdown
Member

I'd prefer to use the workaround that avoids symbols in the main package, but we can merge this now to unblock VMR

@AndriySvyryd AndriySvyryd merged commit f0fd83c into main Mar 3, 2026
10 checks passed
@AndriySvyryd AndriySvyryd deleted the copilot/remove-checked-in-nuspec-files branch March 3, 2026 20:16
@ViktorHofer
Copy link
Copy Markdown
Member

We should truely fix this in sdk so that everyone benefits from it. Don't workaround it.

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.

Avoid checked-in nuspec files dotnet-ef isn't packed properly on MacOS

5 participants