question

yanpeng avatar image
0 Votes"
yanpeng asked TianyuSun-MSFT commented

Bug in Visual Studio 2022: VS doesn't record the line of resourceId + resourceType + external file in the process of creating custom resource.

CustomResource.zipThis is the version I used now
204467-vs-version.png

I created a empty solution then add a empty project. After that, copy a file poepoem.txt to the project folder, add a custom resource whose type is TEXT, in the Filename field filled with poepoem.txt. Save. Pop up an error:
204478-error.png

I tried many times, It is hard to add a custom resource successfully in this way. I have to add
```
IDR_TEXT2 TEXT "poepoem.txt"
```
to the resouce script. In other words, Visual Studio didn't add this line. I uploaded this project here CustomResource.


vs-general
vs-version.png (53.5 KiB)
error.png (4.6 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

TianyuSun-MSFT avatar image
0 Votes"
TianyuSun-MSFT answered TianyuSun-MSFT commented

Hi @yanpeng ,

Welcome to Microsoft Q&A forum.

I think I can reproduce your issue, but to confirm it, could you elaborate and share the whole steps with me to check again?

I have currently reported this potential issue on our Developer Community, here’s the link. If you have more details to fill, please feel free to add comments there or let me know.

Thanks for helping us make VS better.

Best Regards,
Tianyu


If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi, thanks for help. I use the following steps.
1. Create an blank solution in Visual Studio latest version named CustomResource
2. Add an empty C++ project to this solution. Named TestCustomResource.
3. Copy the file poepoem.txt into the project TestCustomResource (in the folder TestCustomResource)
4. Add poepoem.txt in the Resource Files filter.
5. Right click Resource Files then Add a resource.
6. Click Custom, resource type is TEXT.
7. Double click the resouce script TestCustomResource.rc.
8. Now we switch to the Resource View, under the TestCustomResource.rc folder, we can see the "TEXT" resource type.
9. Click IDR_TEXT1, in the field Filename of the Properties window, fill up poepoem.txt then press Enter.
10. Press the Save button (like a softdisk)

Sometimes, you will get an error message box here(I often got this error yesterday), sometimes you dont get this error, but cannot see the poem echo. In any case, the resouce script TestCustomResource.rc doesn't contain a line of text
```
IDR_TEXT1 TEXT "poepoem.txt"
```
I think this is a bug.
(btw, the poepoem.txt can be any text file)



0 Votes 0 ·

Hi @yanpeng , thanks for sharing me the complete steps to reproduce. I can now confirm that this issue is reproducible.

Regards,
Tianyu

0 Votes 0 ·