Unhandled exception. System.TypeInitializationException: The type initializer for 'Alternet.Common.TypeScript.TypeScriptProject' threw an exception.
--> System.IO.FileLoadException: Could not load file or assembly 'System.Drawing, Version=220.127.116.11, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Is this due to the dependency on WinForms as mentioned in Is there an example running on .Net Core?? If so any ETA for a fix for this?
I created a simple .NET 6 console application which evaluates an expression using the Scripter for TypeScript, and it seems to work fine. You can download the project from here.
I expect that you are experiencing this issue with some other test code. Could you please make a small sample project that illustrates the issue and send it to us?
I managed to reproduce it using your sample app. Add this line of code after the using statement:
string defPath = Alternet.Common.TypeScript.TypeScriptProject.DefaultProject.AutoGeneratedTypeDefinitionsPath;
Then run the app and you will get the same error I am seeing.
Thank you for your reply.
You can add the following lines to your .csproj file as a workaround:
This is because the Scripter uses some types from Windows Forms. Does this solution work for you?
Yes, that fixed my problem, thanks!