X# Scripting question

This forum is meant for questions and discussions about the X# language and tools
User avatar
wriedmann
Posts: 3765
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

X# Scripting question

Post by wriedmann »

Hi Chris,

thank you very much!

When you are ready, I'll need to find an alternative way to the .config file as I have to implement this functionality in a DLL library (that is loaded dynamically at runtime).

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
wriedmann
Posts: 3765
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

X# Scripting question

Post by wriedmann »

Hi,

if someone is interested: Chris has sent me yesterday an old version of the scripting DLLs, and they work now.

This is the code:

Code: Select all

method Process( cScriptCode as string ) as string 
local cReturn as string
local oReturn as object
	
cReturn := "" 
try                   
		
oReturn := XSharpScript.EvaluateAsync( ;
    cScriptCode, ScriptOptions.Default, _oParameters ):Result
cReturn	:= oReturn:ToString()
		
catch oEx as Exception
		
MessageBox.Show( _oOwner, oEx:Message, "Script error" )
		
end try
	
return cReturn
and I had to add a .config file with the following content:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"/>
    </startup>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.IO.FileSystem" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
      </dependentAssembly>
    </assemblyBinding>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-1.2.1.0" newVersion="1.2.1.0" />
      </dependentAssembly>
    </assemblyBinding>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Security.Cryptography.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>
and a few DLLs more:

System.Collections.Immutable.dll
System.IO.FileSystem.dll
System.Reflection.Metadata.dll
System.Security.Cryptography.Algorithms.dll
System.Security.Cryptography.Primitives.dll
System.Text.Encoding.CodePages.dll
System.ValueTuple.dll
System.Xml.ReaderWriter.dll
XSharp.CodeAnalysis.dll
XSharp.CodeAnalysis.dll.config
XSharp.Scripting.dll

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
wriedmann
Posts: 3765
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

X# Scripting question

Post by wriedmann »

To complete my message: attached to this message you will find a zip archive with the application source as XIDE export file and the needed DLLs.

Wolfgang
Attachments
ScriptTest.zip
(3.36 MiB) Downloaded 47 times
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
robert
Posts: 4540
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

X# Scripting question

Post by robert »

Wolfgang,

Would it help if we build the scripting DLL against the .Net Framework in stead of .Net Standard, so you it depends on less assemblies?

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
wriedmann
Posts: 3765
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

X# Scripting question

Post by wriedmann »

Hi Robert,

yes, that would definitely help. Since .NET Standard has no GUI, there is no possibility to build GUI applications against .NET Standard.

For web server applications it would be better to have .NET Standard. Maybe you could deliver both versions?

Thank you for asking!

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Post Reply