You don't have folders within a DLL. A .Net assembly (DLL) only contains:
- The assembly manifest
- Type declarations (to be used by other libraries)
- MSIL code that implements these types (compiled code that actually runs)
- binary/string resources
What you probably want to use is resources, i.e. embedding files from your Visual Studio project structure into the output assembly. They can and will be organized by using namespaces, which resembles folders. You can select a BuildAction Embedded Resource
in the file properties for individual files to do so (select the file and R-Click > Properties). These resources can be accessed from the code using
Assembly.GetExecutingAssembly().GetManifestResourceStream("TessDll.tesseract-master.1153.your-file-here")`.
I'm not sure about the .
in your folder name, maybe you need to avoid that. If you want to embed all content of a folder as a resource, you need to edit the .csproj file as described here.
I recommend downloading ILSpy - it's a tool by which you can open .net assemblies and have a peek what's inside.
Alternatively, be aware that you don't need to embed your resources into your assembly to have them available in the bin
output folder. You can just set the Copy to Output Directory property to true
in the file properties and then access the file using your original approach with AppDomain.CurrentDomain.BaseDirectory
. Again, you would have to do that for every single file manually, but you can also do it for a whole folder by editing the .csproj file with wildcards:
<ItemGroup>
<Content Include=".\tesseract-master.1153\**">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>