Click here to Skip to main content
15,903,175 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi My solution have multiple projects. project1,project2,project3 etc.. Project1 have one directory with one text file. i referenced this project1 to project3. Now i'm trying to get the file from project3. but i cant access. its return null..

My code is
C#
var loadAssembly = Assembly.LoadFrom("Test.Module.dll");

          rep.LoadLayout(loadAssembly.GetType().Assembly.GetManifestResourceStream(
                  "Test.Module.EmbeddedFiles." + reportName + ".txt"));

C#




How can i access the file
Posted

Hi Sencsk,

The code you're using seems to be correct. You should check if you can load the embedded resource and also check if the name of the resource is the identical to the name you're trying to use to load it. If there is a deviation, it will return null when you tried to load the resource.
C#
var loadAssembly = Assembly.LoadFrom("Test.Module.dll");
string[] names = loadAssembly.GetType().Assembly.GetManifestResourceNames();

iterate through names and see what differs.

Hope this helps :)
 
Share this answer
 
C#
rep.LoadLayout(Assembly.LoadFrom("Test.Module.dll").ManifestModule.Assembly.GetManifestResourceStream(
          "Test.Module.EmbeddedFiles." + reportName + ".txt"));
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900