SRC
SRC

Reputation: 43

C# Console application properties.resources isn't working? What reference can I use to fix this?

so I'm basically making a program and it needs to pull a file from it's resources, I'm using

 WriteFileToPath(ConsoleApplication2.Properties.Resources.raw, Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + @"\" + FileName + ".exe");

But actually getting the error: Error 1 The type or namespace name 'Properties' does not exist in the namespace 'ConsoleApplication2' (are you missing an assembly reference?) c:\users\sand n\documents\visual studio 2013\Projects\ConsoleApplication2\ConsoleApplication2\Program.cs 31

What reference can I use to fix this, I know it can be done for a fact because my friend's actually doing the same thing.

Upvotes: 0

Views: 1666

Answers (1)

Sudhakar Tillapudi
Sudhakar Tillapudi

Reputation: 26209

Problem : you are are adding the resource(in your case exe file) as a normal project file using Add Existing file option.

Solution : you should add the Resource(in your case exe file) using Resources tab from the project properties window.

Try This:

1.Right click on project and goto Properties.
2.Goto Resources tab.
3.click on Add Resource dropdown menu on top.
4.Select Add Exisiting FIle....
5.Select the exe file you want to add.

Now from program try to access as below:

<ApplicationName>.Properties.Resources.<FileName>

Upvotes: 2

Related Questions