dotnet / dotnet/wpf

Xaml Resources as Baml and EmbeddedResources

Open
#8,725 3 comments 5 reactions 0 assignees View on GitHub
Question
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

### Description

I migrated a control library from using MSBuild 4 to new sdk-style

From
``
To
``

In old project the xaml resource were included in the dll as both baml and resources

For example the xaml file C1Button.xaml
![image](https://github.com/dotnet/wpf/assets/17496741/62262e75-0766-4f37-8eec-c241cb82bb96)
![image](https://github.com/dotnet/wpf/assets/17496741/b17fa274-8b13-41c0-9d25-6578fbd71592)
In the dll is compiled as baml
![image](https://github.com/dotnet/wpf/assets/17496741/160bfef2-e57a-417f-972f-09765298f0e1)
And included as it is as a resource
![image](https://github.com/dotnet/wpf/assets/17496741/06169e38-ca58-4a9b-aae4-32f7a9ebfcd0)

But when migrating to new sdk-style project the xaml is only compiled to baml
![image](https://github.com/dotnet/wpf/assets/17496741/c4c830c2-49d6-44c1-a49a-f1af0540a11d)

How can I specify the xaml should be included as both baml and resource?

### Reproduction Steps

Create a WPF library using old MS Build 4
Add a xaml resource to it
Compile it and see the resources in IL disassembler tool
Migrate project to use new sdk-style
Compile the migrated project
See the resources in the dll

### Expected behavior

Both dll's should be identical

### Actual behavior

The dll doesn't include the xaml as a resource

### Regression?

Yes, this worked fine with MSBuild 4

### Known Workarounds

_No response_

### Impact

_No response_

### Configuration

_No response_

### Other information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.