Fail to build viewer sample VB project in VS2015

I downloaded the sample package and tried build it at my local.
It gives me following error
1>D:\Samples\GroupDocs\GroupDocs.Viewer-for-.NET-master\Examples\GroupDocs.Viewer.Examples.VisualBasic\GroupDocs.Viewer.Examples.VisualBasic.vbproj(155,5): error : This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see Troubleshooting NuGet Package Restore in Visual Studio | Microsoft Learn. The missing file is D:\Samples\GroupDocs\GroupDocs.Viewer-for-.NET-master\Examples\.nuget\NuGet.targets.

I have tried restore, updates, add reference of Groupdocs.Viewers.dll.
But I always got the same error.

Please help

Hi Herbert,


Thanks for sharing your issue with us.

Please don’t forget to enable NuGet Packages Restore option to download/add the missing packages/references after loading the project in Visual Studio. You can do it by following below steps.

  • Right click on solution and press "Enable NuGet package Restore"
  • Right click on solution and press "Manage NuGet packages for Solution"
  • Press “Restore” button
  • Build the project


In case you are using Visual Studio 2015 or greater, please remove the tags mentioned in this screenshot from the project file (.vbproj) and then reload the project. Hope it helps.

Warm Regards

Thanks for the reply

I can build the VB project after following your steps above.
But I can’t run it because my .net framework is 4.5. I change the VB target platform to 4.5, the program just quit immidiately.

Is this sample only support .net framework 4.0?


Hi Herbert,


Thanks for your response.

The sample project is also compatible with .NET Framework 4.5 and it is running without any issue at our end. Can you please debug the application to locate the point where it gets terminated? We shall be looking forward to your response.

Warm Regards

the error happens when new configuration in utilities.vb see code below.
Public Shared Function GetConfigurations() As ViewerConfig
'ExStart:Configurations
>>>>>> Dim config As New ViewerConfig()
'set the storage path
config.StoragePath = StoragePath
'Uncomment the below line for cache purpose
'config.UseCache = true;
config.CacheFolderName = “CacheFolder”
Return config
'ExEnd:Configurations

End Function


The exception is can’t find configuration file.
An unhandled exception of type ‘System.Configuration.ConfigurationErrorsException’ occurred in GroupDocs.Viewer.dll
Additional information: Unable to load configurations file.

I have tried dll inside the downloaded packages and the one included in msi package.


Hi Herbert,


Thanks for sharing with us the details.

We shall investigate your issue and get back to you shortly. We appreciate your patience.

Warm Regards

Hi Herbert,


Thanks for being patient.

We have investigated your reported problem at our end and found that the configuration tag was not placed at the right position in app.config file. We have updated the source code on the GitHub repository. Please download the updated source code and check if the issue is resolved at your end. Furthermore, if you do not want to configure the properties of ViewerConfig class using the app.config file then you can remove the relevant tags from app.config file. For details, please visit this link.

In case you would have any confusion, please do let us know.

Warm Regards

It runs after I use the new app.config.

During my testing, I found the watermark feature is not working. Is it because of the demo version?

Also, the VB sample is not well tested. there are code with obvious error like below in ViewGenerator.vb
Utilities.SaveAsImage(image.PageNumber + “_” + DocumentName, image.Stream)

One more question, do you provide API for C++?

Thanks

Hi Herbert,


We apologize for inconvenience.

We shall investigate the watermark issue and share the outcomes with you shortly. Furthermore, thanks for pointing out the error in the VB sample. We’ll surely test the application again for these errors. Please stay tuned with us.

Warm Regards
Hi Herbert,

Thanks for your patience.

We have checked the watermark functionality and it is working fine in evaluation mode as well. If you haven't changed the paths in the example project then after executing the watermark code please open the ..\Data\Output\html\ directory and check if the watermark is there in the html pages. Please don't forget to clean the cache directory before running the code again.

Furthermore, GroupDocs.Viewer for .NET is not available for C++. However, you can create your own wrapper in order to use it in you C++ application.

In case you would have any other questions, please do let us know.

Warm Regards