Skip to content

Commit 9e7529b

Browse files
committed
Update to .NET 10 and C# 14
Update nugets
1 parent 6564975 commit 9e7529b

4 files changed

Lines changed: 14 additions & 10 deletions

File tree

DynamicRun/Builder/Compiler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public static byte[] Compile(string filepath)
4343
private static CSharpCompilation GenerateCode(string sourceCode)
4444
{
4545
var codeString = SourceText.From(sourceCode);
46-
var options = CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp13);
46+
var options = CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp14);
4747

4848
var parsedSyntaxTree = SyntaxFactory.ParseSyntaxTree(codeString, options);
4949

DynamicRun/DynamicRun.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net9.0</TargetFramework>
6-
<LangVersion>13</LangVersion>
5+
<TargetFramework>net10.0</TargetFramework>
6+
<LangVersion>14</LangVersion>
77
</PropertyGroup>
88

99
<ItemGroup>
@@ -16,9 +16,9 @@
1616
</ItemGroup>
1717

1818
<ItemGroup>
19-
<PackageReference Include="Microsoft.CodeAnalysis.Compilers" Version="4.12.0"/>
20-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.12.0"/>
21-
<PackageReference Include="System.Reactive" Version="6.0.1"/>
19+
<PackageReference Include="Microsoft.CodeAnalysis.Compilers" Version="5.0.0-2.final" />
20+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="5.0.0-2.final" />
21+
<PackageReference Include="System.Reactive" Version="6.1.0" />
2222
</ItemGroup>
2323

2424
</Project>
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
using System;
22

3-
const string s = $"Hello{" "} World"; // C# 10 Constant Interpolated Strings
4-
var hello = $"{s} from {args[0]}!";
3+
var hello = $"{Hello.Word} from {args[0]}!";
54

6-
Console.WriteLine(hello);
5+
Console.WriteLine(hello);
6+
7+
static class Hello
8+
{
9+
public static string Word => field ??= "Hello World"; // C# 14 field keyword
10+
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# DynamicRun
22

3-
Dynamically run code using .NET (Core 3.0, Core 3.1, 5, 6, 7, 8 and 9) Roslyn and AssemblyLoadContext
3+
Dynamically run code using .NET (Core 3.0, Core 3.1, 5, 6, 7, 8, 9 and 10) Roslyn and AssemblyLoadContext
44

55
You can read about it on my blog "[Dynamically compile and run code using .NET Core 3.0](https://laurentkempe.com/2019/02/18/dynamically-compile-and-run-code-using-dotNET-Core-3.0/)"
66

0 commit comments

Comments
 (0)