Skip to content

Conversation

@tmat
Copy link
Member

@tmat tmat commented May 25, 2025

Context

csc task in design-time build does not currently get the list of embedded resources as an input and thus does not include them in the generated command line.

Target _GenerateCompileInputs that generates the inputs needs EmbeddedResource to have metadata WithCulture, Type and OutputResource set. The former two are set in SplitResourcesByCulture target, which is a dependency of PrepareResourceNames target. The OutputResource is currently set by GenerateResource task.

To support updating resources during Hot Reload Roslyn needs to track resource files. To do that /resource command line arguments need to be produced by csc task at design-time.

Changes Made

This change moves setting of OutputResource metadata to a new target AssignEmbeddedResourceOutputPaths that is a dependency of PrepareResourceNames.

The change also includes PrepareResourceNames in the dependencies of _GenerateCompileInputs target, so that it is run during design-time build.

Testing

Manual testing of DTB with this change.

Notes

Copilot AI review requested due to automatic review settings May 25, 2025 16:32
Copy link
Contributor

Copilot AI left a comment

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 aims to include embedded resource information in the command line arguments produced by csc during design-time builds to support resource updates during Hot Reload.

  • Introduces a new target, AssignEmbeddedResourceOutputPaths, to assign OutputResource metadata for EmbeddedResource items.
  • Updates the PrepareResourceNames dependency chain and modifies the _GenerateCompileInputs target to include PrepareResourceNames, ensuring resources are processed.
  • Adjusts the OutputResources property to utilize the new OutputResource metadata.
Comments suppressed due to low confidence (1)

src/Tasks/Microsoft.Common.CurrentVersion.targets:3268

  • Consider adding automated tests to verify that the OutputResource metadata is correctly assigned for EmbeddedResource items during design-time builds.
<Target Name="AssignEmbeddedResourceOutputPaths">

@MichalPavlik MichalPavlik self-requested a review May 27, 2025 14:04
Co-authored-by: Rainer Sigwald <raines@microsoft.com>
@YuliiaKovalova YuliiaKovalova merged commit e2e12b5 into dotnet:main Jun 2, 2025
10 checks passed
@YuliiaKovalova
Copy link
Member

This PR causes issue in the other repo, I am reverting it to unblock VMR
dotnet/dotnet#918 (comment)

@tmat
Copy link
Member Author

tmat commented Jun 3, 2025

I found the problem. Working on a fix.

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.

3 participants