Hello.
I looked at this topic but still no luck ASP.NET Core 6.0.7 Support - #13 by bkbejawada
I’m evaluating Groupdocs.Assembly and am trying to run a simple concole app in .NET 6
I added all the internal packages but still get a runtime error:
System.TypeInitializationException
HResult=0x80131534
Message=The type initializer for ' ’ threw an exception.
Source=GroupDocs.Assembly
StackTrace:
at . (String )
at . ( , , String , Boolean , Object[] )
at . ( , String , , String , , Boolean )
at GroupDocs.Assembly.DocumentAssembler.( , String , , String , LoadSaveOptions , DataSourceInfo[] )
at GroupDocs.Assembly.DocumentAssembler.AssembleDocument(String sourcePath, String targetPath, LoadSaveOptions loadSaveOptions, DataSourceInfo[] dataSourceInfos)
at GroupDocs.Assembly.DocumentAssembler.AssembleDocument(String sourcePath, String targetPath, DataSourceInfo[] dataSourceInfos)
at Program.$(String[] args) in C:\Users\mark\source\repos\GroupDocs\Program.cs:line 17
This exception was originally thrown at this call stack:
[External Code]
Inner Exception 1:
TypeInitializationException: The type initializer for ' ’ threw an exception.
Inner Exception 2:
InvalidOperationException: Operation is not valid due to the current state of the object.
The code:
using GroupDocs.Assembly;
Console.WriteLine(“Hello World!”);
//Setting up source document template
const String strDocumentTemplate = “c:\temp\Mark.docx”;
//Setting up destination Markdown reports
const String strDocumentReport = “c:\temp\test.docx”;
//Setting up description variable
const string description = "GroupDocs.Assembly for .NET is a class library that enables you to generate documents in popular " +
"office and email file formats based upon template documents and data obtained from various sources " +
“including databases, XML, JSON, OData, objects of custom .NET types, external documents, and more.”;
DocumentAssembler assembler = new DocumentAssembler();
//Assemble Document
assembler.AssembleDocument(
strDocumentTemplate,
strDocumentReport,
new DataSourceInfo(“GroupDocs.Assembly for .NET”, “FIRSTNAME”),
new DataSourceInfo(description, “TITLE”));
When running the exact same code in a .NET Core 3.1 console app, it works just fine.