I have added resource file , i added the build action to binary and included the folder !
but i am still unable to read it ! how to read the file path after you added it as resource
i am using this code
var dirPath = Assembly.GetExecutingAssembly().Location;
dirPath = Path.GetDirectoryName(dirPath);
string HtmlFilePath = Path.GetFullPath(Path.Combine(dirPath, @"ATsPdfTemplate\pdf.html"));
string Logo = Path.GetFullPath(Path.Combine(dirPath, @"ATsPdfTemplate\ats.png"));
string Footer = Path.GetFullPath(Path.Combine(dirPath, @"ATsPdfTemplate\world_map.png"));
Hello Omar,
Try to set Build Action to Embedded Resource then use "assembly.GetManifestResourceStream()"
you can check following URL:
https://stackoverflow.com/questions/3314140/how-to-read-embedded-resource-text-file
Bro , i have many resources ! i need to read image path for example ! i dont want to read file test
how to reach the path of that resource and read it
you can follow same way to get path of file regardless its type
This only work with Resx file ! i dont use resx file bro !
i have local folder has the files !
i tried it and it didnt work
string MiniResult = string.Empty;
var assembly = Assembly.GetExecutingAssembly();
var resourceName = "OutSystems.NssPDFTest.pdf.html";
using (Stream stream = assembly.GetManifestResourceStream(resourceName))
using (StreamReader reader = new StreamReader(stream))
{
MiniResult = reader.ReadToEnd();
}
in .net embeeded
and in integration copy to application
didnt work