I have a server running the DocumentEditor Import service. The code of such service is basically equal to the one posted here: https://github.com/SyncfusionExamples/EJ2-DocumentEditor-WebServices/tree/master/ASP.NET%20Core.
Now, I want to have a FileSystems CustomProperties (this one: https://help.syncfusion.com/file-formats/docio/working-with-word-document?cs-save-lang=1&cs-lang=asp.net%20core#working-with-word-document-properties), so I added this to the DocumentEditorController.cs file:
[AcceptVerbs("Post")]
[HttpPost]
[EnableCors("AllowAllOrigins")]
[Route("CustomProperties")]
public string CustomProperties(IFormCollection data)
{
if (data.Files.Count == 0)
return null;
Stream stream = new MemoryStream();
IFormFile file = data.Files[0];
int index = file.FileName.LastIndexOf('.');
string type = index > -1 && index < file.FileName.Length - 1 ?
file.FileName.Substring(index) : ".docx";
file.CopyTo(stream);
stream.Position = 0;
WordDocument document = WordDocument.Load(stream, GetFormatType(type.ToLower()));
document.CustomDocumentProperties.Add("genesisId", "some_random_id");
string json = Newtonsoft.Json.JsonConvert.SerializeObject(document);
document.Dispose();
return json;
}
Problem is, when I try to compile the code, I get this:
Failed to download package 'Microsoft.Extensions.Configuration.UserSecrets.2.0.0' from 'https://api.nuget.org/v3-flatcontainer/microsoft.extensions.configuration.usersecrets/2.0.0/microsoft.extensions.configuration.usersecrets.2.0.0.nupkg'.
The download of 'https://api.nuget.org/v3-flatcontainer/microsoft.extensions.configuration.usersecrets/2.0.0/microsoft.extensions.configuration.usersecrets.2.0.0.nupkg' timed out because no data was received for 60000ms.
Exception of type 'System.TimeoutException' was thrown.
Failed to download package 'Microsoft.AspNetCore.Mvc.DataAnnotations.2.0.2' from 'https://api.nuget.org/v3-flatcontainer/microsoft.aspnetcore.mvc.dataannotations/2.0.2/microsoft.aspnetcore.mvc.dataannotations.2.0.2.nupkg'.
The download of 'https://api.nuget.org/v3-flatcontainer/microsoft.aspnetcore.mvc.dataannotations/2.0.2/microsoft.aspnetcore.mvc.dataannotations.2.0.2.nupkg' timed out because no data was received for 60000ms.
Exception of type 'System.TimeoutException' was thrown.
Restore completed in 1.16 min for /App/EJ2APIServices.csproj.
Controllers/DocumentEditorController.cs(53,22): error CS1061: 'WordDocument' does not contain a definition for 'CustomDocumentProperties' and no accessible extension method 'CustomDocumentProperties' accepting a first argument of type 'WordDocument' could be found (are you missing a using directive or an assembly reference?) [/App/EJ2APIServices.csproj]
The command '/bin/sh -c dotnet publish -c Release -o /out' returned a non-zero code: 1
scripty ERR! script failed: '/home/guerra/projects/megazord/applications/syncfusion-service/scripts/build/index.sh'
scripty ERR! exit status: 1
Looking at the docs, I found something about Assemblies. Up to today, I have never heard of them (I'm not a .NET Core developer) so I'm not sure if I'm using them correctly.
Anyway, I got the Syncfusion.DocIO.Portable.dll, Syncfusion.DocIO.Portable, Syncfusion.Compression.Portable.dll, Syncfusion.Compression.Portable.xml, Syncfusion.OfficeChart.Portable.dll, Syncfusion.OfficeChart.Portable.xml, files from Syncfusion/Essential Studio/FileFormats/18.3.0.35/Assemblies/.NET Standard 2.0+ and put them on a Assemblies folder on src/. Then I tried to load those assemblies using Assembly.Load() but got no results (indeed, I tried passing a non-sensical string to force and error but nothing happened).
Could anyone helpo me?