简体   繁体   中英

stream is null on GetManifestResourceStream for groupdocs.total

I already googled about my problem but sadly I am not able to succeed.

So I have many desktop application in which I am using groupdocs.total product,

so what I usually do is I paste my .lic file in my root folder and in my program.cs file on start function I execute the below line of code

var appAssembly = Assembly.GetExecutingAssembly();
var resourceName = "DocProScan.GroupDocs.Total.lic";//DocProScan is my project name
using (Stream stream = appAssembly.GetManifestResourceStream(resourceName))
{
    GroupDocs.Viewer.License licViewer = new GroupDocs.Viewer.License();
    licViewer.SetLicense(stream);
}

and I set my license like above,

but now I created another desktop application called ScanConsoleApplication this is a desktop console application and I did the same here, I paste the .lic file in the root directory and executed the below code

var appAssembly = Assembly.GetExecutingAssembly();
var resourceName = "ScanConsoleApplication.GroupDocs.Total.lic"; //ScanConsoleApplication is my project name
using (Stream stream = appAssembly.GetManifestResourceStream(resourceName))
{
    GroupDocs.Viewer.License licViewer = new GroupDocs.Viewer.License();
    licViewer.SetLicense(stream);
}

now in the above line of code my stream is coming null.

I don't understand what I miss here.

A good way to diagnose your issue is to list all available manifest resources with appAssembly.GetManifestResourceNames() and see if you have a typo in your resource name.

Also make sure that you are properly including your license file in your project file (.csproj) with an EmbeddedResource item.

<ItemGroup>
  <EmbeddedResource Include="GroupDocs.Total.lic" />
</ItemGroup>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM