c# - How to get a folder location from the bin folder inside a dll project? -
c# - How to get a folder location from the bin folder inside a dll project? -
i'm creating dll project. 1 type of communication dll needs send emails based on .txt templates.
example of folder location :
c:\visualstudioprojects\generatorapp\bin\debug (or release) \documents
for calling folder these .txt files reside used ( in project of dll)
var foldername = "documents"; path.combine(assembly.getentryassembly().location + foldername);
in first place worked, when calling function dll via webservice address no longer right resulting in filenotfoundexceptions.
the documents folder , .txt files beingness copied the output bin. (copy always).
i tried next methods of course of study gave other results couldn't help me.
assembly.getexecutingassembly().location
or
var dm = typeof(appdomainmanager); dm.assembly.location;
any thoughts of how can solve problem?
edit:
various output received:
getentryassembly = null => no location grab getexecutingassembly location = "c:\\windows\\microsoft.net\\framework\\v4.0.30319\\temporary asp.net files\\#####\\d37e9080\\ff60155b\\assembly\\dl3\\24596b30\\c542f015_588ccf01\\generatorapp.dll" appdomainmanager location = "c:\\windows\\microsoft.net\\framework\\v4.0.30319\\mscorlib.dll"
docs assembly.getentryassembly() homecoming assembly uses dll, because entry assembly , not dll.
it worked in test project because exe , dlls in 1 location can otherwise working environment.
try utilize assembly.getexecutingassembly() instead.
and sure have marked these files resource
on properties tab?
or can seek embeb these templates resources dll if static info won't changed often
c# dll
Comments
Post a Comment