5

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.

4

1 回答 1

3

最有可能的问题是,资源文件的访问修饰符是 default = internal,这意味着它仅在 dll 内部可见。转到资源页面并尝试将其更改为公开:

在此处输入图像描述

于 2013-06-14T21:36:53.570 回答