-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.NET Core 3.0 embedded resources weren't compiled into executable #1754
Comments
@rainersigwald do you have any ideas what’s going on? |
Using the repro project, I also don't see an image when running the application, but I do see a byte-array resource embedded: That matches what I'd expect from the resx: <data name="_592e202b3f70f28bd23fd9f830a8fb0a" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>592e202b3f70f28bd23fd9f830a8fb0a.jpg;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data> @vatsan-madhavan, can you take the next step? I don't know what <Image Source="/Resources/592e202b3f70f28bd23fd9f830a8fb0a.jpg"></Image> boils down to in terms of interacting with the embedded resources. |
@hez2010, can you elaborate on this, please? The embedding process changed a lot in 3.0 but we're not aware of any specific problems. What else have you found not to work? |
@rainersigwald
Then you will find all resources becomes null. A repro sample: However, I think this issue is different from the wpf issue I mentioned in the top post because using resources in wpf xaml doesn't require a resx file. |
@hez2010 your original post repros also on Desktop Framework if you reconstruct what you specify in the .NET Core project, so its not a runtime/build failure, but probably misconfiguration due to bad defaults. It works in the designer because it looks in the file system of the project. Note that WPF doesn't use resx resources, you should use the WPF-style resource embedding. ( As far as the second example is concerned, I don't know if Core WPF is globally including all image extensions under the In this case the fix is for WPF SDK to either turn off globbing of images and similar resources (so you have to add them manually under the right build action like Desktop, ideally having the same defaults in the project system to get the same experience) or replicate the default build actions of the Desktop Framework WPF project system in the automatically included files. Automatically including files as |
As for the issue I mentioned in my original post, after changing build option of my images to As for the second issue |
See related issue/discussion at dotnet/project-system#4534 |
@hez2010 let's know if we can close out this issue now since you seem to have a path forward. |
Yes, this issue can be closed because it was caused by dotnet/project-system#4534, not WPF itself. |
Problem description:
Embedded resources weren't compiled into executable.
I added an image to a resx file Resource1.resx, and add the resource file to project file:
Then I use this image in WPF
<Image Source="..." />
Actual behavior:
The image should display in my WPF app.
Expected behavior:
The image can only display in Visual Studio XAML Designer.
Minimal repro:
WpfTest.zip
Update
Not only WPF projects, all kinds of projects in .NET Core 3.0 cannot correctly use resource files.
The text was updated successfully, but these errors were encountered: