views:

133

answers:

1

I'm writing a console application in Visual Basic 2008 Express.

I added several text files to my project as resources. Specifically...

  1. I went to my project's "Properties" page and selected the "Resources" tab.
  2. I clicked the "Add Resource" dropdown and chose "Add New Text File".
  3. I entered some simple text and saved the file as "Welcome.txt".
  4. I built the entire solution.

In my code, I use console.writeline(My.Resources.Welcome) to display the text.

If I run my code through the IDE, it works fine. If I run the EXE that's in the /bin/release folder, the app crashes.

My system logs show the error as "System.IO.FileLoadException".

I have tried setting the properties on the embedded text file to "Embedded Resource", but the result is the same.

Has anyone encountered this issue? Thank you in advance.

A: 

Copy Welcome.txt to your bin\release folder.

OR

To make Welcome.txt an embedded resource, right-click either the text file or the bitmap, and then select Properties.

In the Properties dialog box, locate the Build Action property. By default, this property is set to Content. Click the property and change the Build Action property to Embedded Resource.

Robert Harvey
That makes sense, but aren't "Embedded Resources" supposed to be compiled into the assembly?
DWRoelands