I'm freaking out with this problem. I want to read the data of a HTML in c#. So, I have an HTML file in the same Class Library in Visual Studio. Visual Studio Class Library distribution
So, I want to use Stream Reader to read the file, with the assembly.
StreamReader reader = new StreamReader(assembly.GetManifestResourceStream("proyectoHADS.LIbreriaClase.EmailTemplate.html"));
But, this returns a null, so I use the GetManifestResourceNames
to check if it exists, but it doesn't because the array is empty. I don't know why I can't get the HTML. The entire code is here:
namespace LibreriaClase
public class EnviarCorreo {
public void enviarCorreo(String correo)
{
....
var assembly = Assembly.GetExecutingAssembly();
string[] names = assembly.GetManifestResourceNames();
StreamReader reader = new StreamReader(assembly.GetManifestResourceStream("proyectoHADS.LIbreriaClase.EmailTemplate.html"));
body = reader.ReadToEnd();`