Skip to content

[Broken Build]: PublishAot=true + NoBuild=true produce binary without EmbeddedResourcesΒ #12712

@MrJul

Description

@MrJul

Issue Description

In certain situations, MSBuild might fail to correctly embed EmbeddedResource items with MSBuild 17.14 when NoBuild=true is specified.

The easiest way to get that behavior is by using PublishAot=true.

The culprit seems to be #10928.
After that PR, _GenerateCompileInputs does not add any EmbeddedResource to the inputs, see the attached binlog.

Steps to Reproduce

With the .NET SDK 9.0.306 / MSBuild 17.14:

  1. Clone https://github.com/MrJul/repro-publish-nobuild-bug (this is an almost empty console application with a single .resx file).
  2. Run dotnet build -p:PublishAot=true
  3. Run dotnet publish -p:PublishAot=true -p:NoBuild=true
  4. Run the published executable
  5. Notice it fails with a MissingManifestResourceException

Reproducible with SDK versions 9.0.300 through 9.0.306, as well as 10.0.100-rc.2.25502.107.
It works without any issue with 9.0.205.

Expected Behavior

The executable has embedded resources and runs without any issue.

Actual Behavior

The executable doesn't have any embedded resources and fails at runtime.

Ask us questions

No response

Metadata

Metadata

Assignees

Labels

Priority:1Work that is critical for the release, but we could probably ship withouttriaged

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions