项目添加资源文件Resource1.resx
“C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.7.2 Tools\ResGen.exe” Resource1.resx
从“Resource1.resx”读入 1 资源
正在写入资源文件… 完成。
排除资源文件Resource1.resx
添加文件Resource1.resources属性生成操作嵌入的资源
//记得加入工程名hex.
For example, if the project is called Kernel and the file is Data\Text.txt, then ResourceName = "Kernel.Data.Text.txt".Stream sm= assem.GetManifestResourceStream("hex.Resource1.resources");if (sm != null){StreamReader sr = new StreamReader(sm);string ret = sr.ReadToEnd();Console.Write(ret);}else{Console.Write("sm is null");}就可以成功了
:\code\test\hex\hex>E:\code\test\hex\hex\bin\x64\Debug\hex.exe
??? ? lSystem.Resources.ResourceReader, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089#System.Resources.RuntimeResourceSet PADPADPa?? ? S t r i n g 1 aaa