Ben Jasperson
Ben Jasperson

Reputation: 314

Add Image to Assets Folder UWP C++

Why can't I add images to my UWP assets folder? I usually use C#, but I have to use C++ because I'll eventually be turning this into an optional package (somebody tell me if I'm wrong, and I can write optional packages in C#).

Using Visual Studio, I right click on the Assets folder in the Solutions Explorer click Add->Existing Item and then click on my image. It shows up in Visual Studio, but it doesn't actually get added to the Assets folder so I'm unable to view it when I load my app. I wouldn't think that it matters whether I use C++ or C#, but one is working and not the other.

I've tried rebuilding the project, rebooting the computer, repairing Visual Studio and I'm still stuck.

As suggested by paxbun, I tried using File Explorer to add the file. If I added the file in the Assets folder with the project files, it didn't help. I was able to get the code to work by adding the file to the AppX folder in the Debug folder, but this won't help when I'm ready to release (to make sure, I did a quick sideload).

I haven't put much at all in the code, but you can view it at https://github.com/benjasperson/SimpleCPPImage

Upvotes: 2

Views: 4472

Answers (1)

Ben Jasperson
Ben Jasperson

Reputation: 314

Upon further research, I found my answer here.

Clicking "Show all files" in the Solution Explorer and then setting "Include in project" to true was all I needed to do.

Upvotes: 2

Related Questions