Repository navigation
File-based apps: support #:include .dll by default - #54396
Conversation
There was a problem hiding this comment.
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
FileBasedProgramsItemMappingto include.dll=Reference. - Update run-api expected virtual project output to reflect the new default mapping.
- Simplify
dotnet project converttests by removing now-unnecessary.dllmapping 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. |
|
@333fred @RikkiGibson for reviews, thanks |
|
@RikkiGibson for another review, thanks |
| File.WriteAllText(Path.Join(srcDir, "Directory.Build.props"), $""" | ||
| <Project> | ||
| <PropertyGroup> | ||
| <{CSharpDirective.IncludeOrExclude.MappingPropertyName}></{CSharpDirective.IncludeOrExclude.MappingPropertyName}> |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
But I guess .cs files are special and do get copied even though they are now missing from the mapping.
There was a problem hiding this comment.
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
.csfiles 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.)
Closes #49129