Skip to content

File-based apps: support #:include .dll by default - #54396

Merged
jjonescz merged 5 commits into
dotnet:release/10.0.4xxfrom
jjonescz:sprint-include-dll
May 29, 2026
Merged

jjonescz merged 5 commits into
dotnet:release/10.0.4xxfrom
jjonescz:sprint-include-dll

Conversation

@jjonescz

@jjonescz jjonescz commented May 21, 2026 •

Copy link
Copy Markdown
Member

Closes #49129

@jjonescz jjonescz added the Area-run-file Items related to the "dotnet run <file>" effort label May 21, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates file-based apps support so that #:include directives targeting .dll files work out-of-the-box by mapping .dll to the MSBuild Reference item type in the default include/exclude mapping.

Changes:

  • Extend the default FileBasedProgramsItemMapping to include .dll=Reference.
  • Update run-api expected virtual project output to reflect the new default mapping.
  • Simplify dotnet project convert tests by removing now-unnecessary .dll mapping directives, and adjust one test to explicitly clear the mapping to preserve the “no mapping” scenario.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
test/dotnet.Tests/CommandTests/Run/RunFileTests_CscOnlyAndApi.cs Updates expected run-api virtual project XML to include .dll=Reference in the mapping.
test/dotnet.Tests/CommandTests/Project/Convert/DotnetProjectConvertTests.cs Removes explicit .dll mapping setup in tests that now rely on the default mapping; adds an explicit empty mapping for the “no mapping” case.
src/Cli/Microsoft.DotNet.FileBasedPrograms/FileLevelDirectiveHelpers.cs Adds .dll=Reference to the default mapping and adjusts mapping parsing behavior.

@jjonescz

Copy link
Copy Markdown
Member Author

@333fred @RikkiGibson for reviews, thanks

@jjonescz
jjonescz requested a review from RikkiGibson May 25, 2026 08:28
@jjonescz

Copy link
Copy Markdown
Member Author

@RikkiGibson for another review, thanks

@DamianEdwards DamianEdwards added this to the 11.0-preview6 milestone May 28, 2026
File.WriteAllText(Path.Join(srcDir, "Directory.Build.props"), $"""
<Project>
<PropertyGroup>
<{CSharpDirective.IncludeOrExclude.MappingPropertyName}></{CSharpDirective.IncludeOrExclude.MappingPropertyName}>

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.

Here I guess by clearing the mappings, a whole bunch of item types won't get copied to the generated project, including the dll 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.

But I guess .cs files are special and do get copied even though they are now missing from the mapping.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Here I guess by clearing the mappings, a whole bunch of item types won't get copied to the generated project, including the dll file?

Yes, I don't expect anyone to do that IRL, it's just a test.

But I guess .cs files are special and do get copied even though they are now missing from the mapping.

Only the entry-point file is special. Other #:included .cs files shouldn't be copied either. (Or rather <Compile Included files, since #:include .cs won't work at all without the mapping.)

@jjonescz
jjonescz enabled auto-merge (squash) May 29, 2026 08:31
@jjonescz
jjonescz merged commit 0c06be5 into dotnet:release/10.0.4xx May 29, 2026
28 checks passed
@jjonescz
jjonescz deleted the sprint-include-dll branch May 29, 2026 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-run-file Items related to the "dotnet run <file>" effort

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants