Skip to content

in a .NET 4.x C# project to dynamically execute .NET 9 code? #34

@ichat001

Description

@ichat001

Thank you for sharing this useful project.

I would like to know whether it is possible to use the westwind.script component in a .NET 4.x C# project to dynamically execute .NET 9 code.

My system environment:

  • .NET 4.8.0 runtime
  • .NET 9.0 runtime

By using the following code, I am able to execute .NET 9 code under PowerShell 5.1 (.NET 4.5).

pwsh -c {
$code = @'
using System;
public static class __cla
{
 public static void __fun()
 {
     Console.WriteLine("hello from .NET9!");
 }
}
'@
Add-Type -TypeDefinition $code -ReferencedAssemblies 'System.Console'
[__cla]::__fun()
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions