Question

I have looked for quite a bit but I haven't found a solution to this seemingly easy problem.

I am able to add a TXT (CSV) file named "CSVData.txt" as resource in a Console Application project and access it using the namespace easily - it's named "CSVData" in the project.

  string Temp = Properties.Resources.CSVData;

But when I create a Class Library project, I cannot: apparently there's nothing in the namespace "Properties.Resources", even though it is created successfully just as in the Console Application project.

Tested multiple times with fresh projects with the same results.

I'm sure it's something very, very simple, but I can't for the life of me figure this one out.

Was it helpful?

Solution

Most probably the problem is, that the access modifier for the resource file is default = internal, which means it is visible only inside of the dll. Go to the resources page and try to change it to Public:

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top