I was trying to set up running .NET from node.js using the Microsoft guide via dotnet workload install wasm-experimental
and dotnet new wasmconsole
.
I want to read the vsdx file from .NET, but I have the error:
Error reading file: Could not find a part of the path'/home/user/project/src/file.vsdx'
The .Net application:
using System;using System.IO;using System.Runtime.InteropServices.JavaScript;using System.IO.Packaging;using System.Linq;return 0;public partial class MyClass{ [JSExport] internal static string Greeting() { try { string filePath = "/empty-template.vsdx"; if (File.Exists(filePath)) { Console.WriteLine("Файлсуществуетпопути: " + filePath); } else { Console.WriteLine("Файлнесуществуетпопути: " + filePath); } try { File.ReadAllBytes(filePath); } catch (Exception ex) { Console.WriteLine($"Error reading file: {ex.Message}"); } } catch (Exception ex) { Console.WriteLine($"Error opening package: {ex.Message}"); } return "filePath"; }
The file exists by path.