Reputation: 1054
This suppose to be a simple issue; not to be posted as a question in stack overflow!
Following this article: How to: Create Embedded Resources
Form1.vb
to test in Visual Studio 2017 community edition.testfile.WAV
file as a test resource.Still no matter what I do, the result.exe
file is so big and reflect the big testfile.wav
file size, and can't at any situation find the wav file as a linked resources in separate file in bin\Debug
folder!
Tried to alter almost everything everywhere; yet no success!
What I expect is to have both result.exe
and testfile.wav
in bin\Debug
folder separately linked and not embedded.
Looks very weird to me? is it a bug in VS or in app setting?
Thank you so much Appreciated any hint
Note: What I was trying to reach is to create a different themes for my application, where users can chose the appearance; and my efforts break in the above scenario. It doesn't make sense that result.exe
ends in 10s of MB if it will include resources inside it!
Upvotes: 1
Views: 636
Reputation: 18310
TL;DR: If you want it as a loose file then you need to have it as a loose file. Resources are always embedded in the application.
If you add the resource via Project Properties > Resources
then it will always be embedded in your application.
If you want it as a loose file then you shall just import it to your project via Add Existing Item
and set the Copy to Output Directory
property of the item to Copy Always
. Then you reference it by doing for example:
Dim WavPath As String = Path.Combine(Application.StartupPath, "yourfile.wav")
Dim WavFile As Byte() = File.ReadAllBytes(WavPath)
Linked vs Embedded only make a difference at design time. Linked resources are still embedded in your application, but at design time you may edit them and can easily add or remove other resources.
Embedded resources however are embedded in a .resx
file even at design time, and to edit such resources you have to export them or change them into a linked resource. Embedded resources are mostly used when you need to share the same resources in multiple projects. The resources are then embedded in the .resx
file so you only need to copy that and not every included file.
Upvotes: 1