c# - Why is the resource stream always null? -


hopefully simple have tried , tried , keep failing. attempting create stream object in c# application copy css file specific location. css file embedded in resources. regardles of have tried stream object null.

can please point in right direction looking @ below?

thanks :) burrows111

assembly assemb = assembly.getexecutingassembly(); stream stream = assemb.getmanifestresourcestream(thisnamespace.properties.resources.clockingsmapstyle); // null!!!! filestream fs = new filestream("to store in location", filemode.create); streamreader reader = new streamreader(stream); streamwriter writer = new streamwriter(fs); writer.write(reader.readtoend()); 

this works me:

streamreader reader; streamwriter writer; stream stream; assembly assembly = assembly.getexecutingassembly();  using (stream = assembly.getmanifestresourcestream("namespace.stylesheet1.css")) using (reader = new streamreader(stream)) using (writer = new streamwriter("test.css")) {     string content = reader.readtoend();     writer.write(content);     writer.close(); }      

i tried in standard windows forms app.

edit: file (stylesheet1.css) included normal item in project build action of "embedded resource".


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -