Visual Studio: Unable to access resources from code

I added several files (HTML, CSS, etc.) as resources for my Visual Studio project. According to MSDN, I must have access to these resources through

MyProjectName.Properties.Resources.Filename

Unfortunately, IntelliSense does not even know the Properties property that underlies MyProjectName. If I type "MyProjectName", IntelliSense offers me a few things, but no properties. I have already built a project, but nothing has changed.

If this is important: this project is not the main / start-up project of my Visual Studio solution.

+3
source share
7 answers

Make the file as a resource from its properties as follows:

BuildAction=Compile
+4
source

You need to add them here:

  • Project menu
  • MyProjectName
  • " , " ( )
  • ""

, MyProjectName.Properties.Resources.Filename

+7

MSDN Forum. , , .

+4

, ? .

0

, Visual Studio Propertieson , Resourcesbut, .

, Solution_name.Properties.Resources.yourFile.png, , Visual Studio, Solution_name\Resources\yourFile.png.

Visual Studio . , Project, Properties ( )? Alt + F7, .

, . , . .

0
source

I know this contradicts what the answer said, but on VS2013 I had to set BuildAction = Resource

0
source

For anyone else, maybe check out the Resources.Designer file?

I found a discrepancy in this line

 System.Resources.ResourceManager("DemoApp.Properties.Resources", ...

I changed the name of the project to Demo.

0
source

All Articles