diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 1072bdeb..d9ebbfdc 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -14,6 +14,7 @@ jobs:
dotnet-version: |
8.0.x
9.0.x
+ 10.0.x
include-prerelease: true
- name: Install dotnet-script
run: dotnet tool install dotnet-script --global
@@ -21,8 +22,8 @@ jobs:
- name: Run build script
run: dotnet-script build/Build.csx
- build-mac:
- runs-on: macos-13
+ build-mac-arm:
+ runs-on: macos-26
steps:
- uses: actions/checkout@v3
@@ -32,6 +33,7 @@ jobs:
dotnet-version: |
8.0.x
9.0.x
+ 10.0.x
include-prerelease: true
- name: Install dotnet-script
run: dotnet tool install dotnet-script --global
@@ -50,6 +52,7 @@ jobs:
dotnet-version: |
8.0.x
9.0.x
+ 10.0.x
include-prerelease: true
- name: Install dotnet-script
run: dotnet tool install dotnet-script --global
diff --git a/README.md b/README.md
index 3482c176..d2542a4d 100644
--- a/README.md
+++ b/README.md
@@ -20,7 +20,7 @@ Run C# scripts from the .NET CLI, define NuGet packages inline and edit/debug th
### Prerequisites
-The only thing we need to install is [.NET 8.0 or .NET 9.0 SDK](https://dotnet.microsoft.com/en-us/download/dotnet).
+The only thing we need to install is [.NET 8.0, .NET 9.0 or .NET10 SDK](https://dotnet.microsoft.com/en-us/download/dotnet).
[Note](https://learn.microsoft.com/en-us/dotnet/core/install/linux-scripted-manual#manual-install):
> If you install the .NET SDK to a non-default location, you need to set the environment variable `DOTNET_ROOT` to the directory that contains the dotnet executable
@@ -267,6 +267,12 @@ The executable you can run directly independent of dotnet install, while the DLL
dotnet script exec {path_to_dll} -- arg1 arg2
```
+### Assembly Load Context
+Starting with version 2.0.0, `Dotnet-Script` will use an isolated load context for loading assemblies. This means that when a script is compiled and executed,
+it will run in total isolation from the script host. There are some edge cases where we might want to opt out of this default. For instance if the script or any
+of its dependencies does a `Assembly.Load`. In that case the isolated load context used by `Dotnet-Script` will not be able to use that assembly.
+To opt out of the isolated load context, pass the `--disable-isolated-load-context` flag when executing the script.
+
### Caching
We provide two types of caching, the `dependency cache` and the `execution cache` which is explained in detail below. In order for any of these caches to be enabled, it is required that all NuGet package references are specified using an exact version number. The reason for this constraint is that we need to make sure that we don't execute a script with a stale dependency graph.
diff --git a/build/Build.csx b/build/Build.csx
index 3aa8a709..cf979d21 100644
--- a/build/Build.csx
+++ b/build/Build.csx
@@ -60,6 +60,7 @@ private void RunTests()
{
Command.Execute("dotnet", "test -c Release -f net8.0", testProjectFolder);
Command.Execute("dotnet", "test -c Release -f net9.0", testProjectFolder);
+ Command.Execute("dotnet", "test -c Release -f net10.0", testProjectFolder);
if (BuildEnvironment.IsWindows)
{
DotNet.Test(testDesktopProjectFolder);
diff --git a/build/Dockerfile b/build/Dockerfile
index 88c8d4fd..59b74f78 100644
--- a/build/Dockerfile
+++ b/build/Dockerfile
@@ -1,4 +1,4 @@
-FROM mcr.microsoft.com/dotnet/sdk:9.0
+FROM mcr.microsoft.com/dotnet/sdk:10.0
# https://www.nuget.org/packages/dotnet-script/
RUN dotnet tool install dotnet-script --tool-path /usr/bin
diff --git a/global.json b/global.json
index 97614a3d..ecd9fdb2 100644
--- a/global.json
+++ b/global.json
@@ -1,6 +1,6 @@
{
"sdk": {
- "version": "9.0.100",
+ "version": "10.0.100",
"rollForward": "latestFeature"
}
-}
+}
\ No newline at end of file
diff --git a/src/Dotnet.Script.Core/Dotnet.Script.Core.csproj b/src/Dotnet.Script.Core/Dotnet.Script.Core.csproj
index 59893f52..d1debdd8 100644
--- a/src/Dotnet.Script.Core/Dotnet.Script.Core.csproj
+++ b/src/Dotnet.Script.Core/Dotnet.Script.Core.csproj
@@ -4,7 +4,7 @@
A cross platform library allowing you to run C# (CSX) scripts with support for debugging and inline NuGet packages. Based on Roslyn.
1.7.0
filipw
- net9.0;net8.0;netstandard2.0
+ net10.0;net9.0;net8.0;netstandard2.0
Dotnet.Script.Core
Dotnet.Script.Core
script;csx;csharp;roslyn
@@ -32,7 +32,6 @@
-
diff --git a/src/Dotnet.Script.DependencyModel/Dotnet.Script.DependencyModel.csproj b/src/Dotnet.Script.DependencyModel/Dotnet.Script.DependencyModel.csproj
index 039dbceb..4e33c49b 100644
--- a/src/Dotnet.Script.DependencyModel/Dotnet.Script.DependencyModel.csproj
+++ b/src/Dotnet.Script.DependencyModel/Dotnet.Script.DependencyModel.csproj
@@ -28,7 +28,7 @@
-
+
\ No newline at end of file
diff --git a/src/Dotnet.Script.DependencyModel/ProjectSystem/PackageVersion.cs b/src/Dotnet.Script.DependencyModel/ProjectSystem/PackageVersion.cs
index 8f484b0b..8ec59b93 100644
--- a/src/Dotnet.Script.DependencyModel/ProjectSystem/PackageVersion.cs
+++ b/src/Dotnet.Script.DependencyModel/ProjectSystem/PackageVersion.cs
@@ -47,6 +47,7 @@ public class PackageVersion : IEquatable
/// The string representation of the package version.
public PackageVersion(string version)
{
+ version = string.IsNullOrWhiteSpace(version) ? "*" : version;
Value = version;
IsPinned = IsPinnedRegex.IsMatch(version);
}
diff --git a/src/Dotnet.Script.Desktop.Tests/CompilationDepenencyTests.cs b/src/Dotnet.Script.Desktop.Tests/CompilationDepenencyTests.cs
index 90ff8087..213633b5 100644
--- a/src/Dotnet.Script.Desktop.Tests/CompilationDepenencyTests.cs
+++ b/src/Dotnet.Script.Desktop.Tests/CompilationDepenencyTests.cs
@@ -7,6 +7,7 @@
namespace Dotnet.Script.Desktop.Tests
{
+ [Collection("IntegrationTests")]
public class CompilationDependencyTests
{
public CompilationDependencyTests(ITestOutputHelper testOutputHelper)
diff --git a/src/Dotnet.Script.Tests/CachedRestorerTests.cs b/src/Dotnet.Script.Tests/CachedRestorerTests.cs
index 8e5c5566..342c4b9d 100644
--- a/src/Dotnet.Script.Tests/CachedRestorerTests.cs
+++ b/src/Dotnet.Script.Tests/CachedRestorerTests.cs
@@ -11,6 +11,7 @@
namespace Dotnet.Script.Tests
{
+ [Collection("IntegrationTests")]
public class CachedRestorerTests
{
private static readonly string[] NoPackageSources = Array.Empty();
diff --git a/src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj b/src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj
index 4b8b7da5..4c03fbf6 100644
--- a/src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj
+++ b/src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj
@@ -1,7 +1,7 @@
- net9.0;net8.0
+ net10.0;net9.0;net8.0
false
true
../dotnet-script.snk
diff --git a/src/Dotnet.Script.Tests/DotnetRestorerTests.cs b/src/Dotnet.Script.Tests/DotnetRestorerTests.cs
index cc408a23..aa9d8b56 100644
--- a/src/Dotnet.Script.Tests/DotnetRestorerTests.cs
+++ b/src/Dotnet.Script.Tests/DotnetRestorerTests.cs
@@ -9,6 +9,7 @@
namespace Dotnet.Script.Tests
{
+ [Collection("IntegrationTests")]
public class DotnetRestorerTests
{
private static PackageReference ValidPackageReferenceA => new PackageReference("Newtonsoft.Json", "12.0.3");
diff --git a/src/Dotnet.Script.Tests/EnvironmentTests.cs b/src/Dotnet.Script.Tests/EnvironmentTests.cs
index b7e25930..4b35fe28 100644
--- a/src/Dotnet.Script.Tests/EnvironmentTests.cs
+++ b/src/Dotnet.Script.Tests/EnvironmentTests.cs
@@ -7,6 +7,7 @@
namespace Dotnet.Script.Tests
{
+ [Collection("IntegrationTests")]
public class EnvironmentTests
{
[Theory]
diff --git a/src/Dotnet.Script.Tests/ExecutionCacheTests.cs b/src/Dotnet.Script.Tests/ExecutionCacheTests.cs
index 55e0ce74..dc90a43b 100644
--- a/src/Dotnet.Script.Tests/ExecutionCacheTests.cs
+++ b/src/Dotnet.Script.Tests/ExecutionCacheTests.cs
@@ -7,6 +7,7 @@
namespace Dotnet.Script.Tests
{
+ [Collection("IntegrationTests")]
public class ExecutionCacheTests
{
private readonly ITestOutputHelper testOutputHelper;
diff --git a/src/Dotnet.Script.Tests/FileUtilsTests.cs b/src/Dotnet.Script.Tests/FileUtilsTests.cs
index 8a2267ab..62116392 100644
--- a/src/Dotnet.Script.Tests/FileUtilsTests.cs
+++ b/src/Dotnet.Script.Tests/FileUtilsTests.cs
@@ -5,19 +5,20 @@
namespace Dotnet.Script.Tests
{
+ [Collection("IntegrationTests")]
public class FileUtilsTests
{
[Fact]
public void GetTempPathCanBeOverridenWithAbsolutePathViaEnvVar()
{
var path = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
- try
+ try
{
Environment.SetEnvironmentVariable("DOTNET_SCRIPT_CACHE_LOCATION", path);
var tempPath = FileUtils.GetTempPath();
Assert.Equal(path, tempPath);
- }
- finally
+ }
+ finally
{
Environment.SetEnvironmentVariable("DOTNET_SCRIPT_CACHE_LOCATION", null);
}
@@ -27,13 +28,13 @@ public void GetTempPathCanBeOverridenWithAbsolutePathViaEnvVar()
public void GetTempPathCanBeOverridenWithRelativePathViaEnvVar()
{
var path = "foo";
- try
+ try
{
Environment.SetEnvironmentVariable("DOTNET_SCRIPT_CACHE_LOCATION", path);
var tempPath = FileUtils.GetTempPath();
Assert.Equal(Path.Combine(Directory.GetCurrentDirectory(), path), tempPath);
- }
- finally
+ }
+ finally
{
Environment.SetEnvironmentVariable("DOTNET_SCRIPT_CACHE_LOCATION", null);
}
diff --git a/src/Dotnet.Script.Tests/NuGetSourceReferenceResolverTests.cs b/src/Dotnet.Script.Tests/NuGetSourceReferenceResolverTests.cs
index 82578387..48ed12be 100644
--- a/src/Dotnet.Script.Tests/NuGetSourceReferenceResolverTests.cs
+++ b/src/Dotnet.Script.Tests/NuGetSourceReferenceResolverTests.cs
@@ -8,6 +8,7 @@
namespace Dotnet.Script.Tests
{
+ [Collection("IntegrationTests")]
public class NuGetSourceReferenceResolverTests
{
[Fact]
@@ -16,6 +17,6 @@ public void ShouldHandleResolvingInvalidPackageReference()
Dictionary> scriptMap = new Dictionary>();
NuGetSourceReferenceResolver resolver = new NuGetSourceReferenceResolver(new SourceFileResolver(ImmutableArray.Empty, Directory.GetCurrentDirectory()), scriptMap);
resolver.ResolveReference("nuget:InvalidPackage, 1.2.3", Directory.GetCurrentDirectory());
- }
+ }
}
}
diff --git a/src/Dotnet.Script.Tests/PackageVersionTests.cs b/src/Dotnet.Script.Tests/PackageVersionTests.cs
index c613444d..70c694ac 100644
--- a/src/Dotnet.Script.Tests/PackageVersionTests.cs
+++ b/src/Dotnet.Script.Tests/PackageVersionTests.cs
@@ -7,6 +7,7 @@ namespace Dotnet.Script.Tests
/// Tests based on https://docs.microsoft.com/en-us/nuget/reference/package-versioning
/// Semantically versioned packages following the Major.Minor.Revision pattern are also considered "pinned"
///
+ [Collection("IntegrationTests")]
public class PackageVersionTests
{
[Theory]
diff --git a/src/Dotnet.Script.Tests/ProjectFileTests.cs b/src/Dotnet.Script.Tests/ProjectFileTests.cs
index 3d8004fc..1aae6f0d 100644
--- a/src/Dotnet.Script.Tests/ProjectFileTests.cs
+++ b/src/Dotnet.Script.Tests/ProjectFileTests.cs
@@ -4,6 +4,7 @@
namespace Dotnet.Script.Tests
{
+ [Collection("IntegrationTests")]
public class ProjectFileTests
{
[Fact]
@@ -26,12 +27,12 @@ public void ShouldParseProjectFile()
public void ShouldBeEqualWhenPackagesAreEqual()
{
var firstFile = new ProjectFile();
- firstFile.PackageReferences.Add(new PackageReference("SomePackage","1.2.3"));
- firstFile.PackageReferences.Add(new PackageReference("AnotherPackage","3.2.1"));
+ firstFile.PackageReferences.Add(new PackageReference("SomePackage", "1.2.3"));
+ firstFile.PackageReferences.Add(new PackageReference("AnotherPackage", "3.2.1"));
var secondFile = new ProjectFile();
- secondFile.PackageReferences.Add(new PackageReference("SomePackage","1.2.3"));
- secondFile.PackageReferences.Add(new PackageReference("AnotherPackage","3.2.1"));
+ secondFile.PackageReferences.Add(new PackageReference("SomePackage", "1.2.3"));
+ secondFile.PackageReferences.Add(new PackageReference("AnotherPackage", "3.2.1"));
Assert.Equal(firstFile, secondFile);
}
@@ -40,11 +41,11 @@ public void ShouldBeEqualWhenPackagesAreEqual()
public void ShouldNotBeEqualWhenPackagesAreDifferent()
{
var firstFile = new ProjectFile();
- firstFile.PackageReferences.Add(new PackageReference("SomePackage","1.2.3"));
- firstFile.PackageReferences.Add(new PackageReference("AnotherPackage","3.2.1"));
+ firstFile.PackageReferences.Add(new PackageReference("SomePackage", "1.2.3"));
+ firstFile.PackageReferences.Add(new PackageReference("AnotherPackage", "3.2.1"));
var secondFile = new ProjectFile();
- secondFile.PackageReferences.Add(new PackageReference("SomePackage","1.2.3"));
+ secondFile.PackageReferences.Add(new PackageReference("SomePackage", "1.2.3"));
Assert.NotEqual(firstFile, secondFile);
}
@@ -80,8 +81,8 @@ public void ShouldNotBeEqualWhenReferencesAreDifferent()
public void ShouldBeCacheableWhenPackagesArePinned()
{
var projectFile = new ProjectFile();
- projectFile.PackageReferences.Add(new PackageReference("SomePackage","1.2.3"));
- projectFile.PackageReferences.Add(new PackageReference("AnotherPackage","3.2.1"));
+ projectFile.PackageReferences.Add(new PackageReference("SomePackage", "1.2.3"));
+ projectFile.PackageReferences.Add(new PackageReference("AnotherPackage", "3.2.1"));
}
}
diff --git a/src/Dotnet.Script.Tests/ScaffoldingTests.cs b/src/Dotnet.Script.Tests/ScaffoldingTests.cs
index 8335de59..549537ec 100644
--- a/src/Dotnet.Script.Tests/ScaffoldingTests.cs
+++ b/src/Dotnet.Script.Tests/ScaffoldingTests.cs
@@ -10,6 +10,7 @@
namespace Dotnet.Script.Tests
{
+ [Collection("IntegrationTests")]
public class ScaffoldingTests
{
private readonly ScriptEnvironment _scriptEnvironment;
diff --git a/src/Dotnet.Script.Tests/ScriptExecutionTests.cs b/src/Dotnet.Script.Tests/ScriptExecutionTests.cs
index f42a4a3a..e9459f93 100644
--- a/src/Dotnet.Script.Tests/ScriptExecutionTests.cs
+++ b/src/Dotnet.Script.Tests/ScriptExecutionTests.cs
@@ -11,6 +11,7 @@
namespace Dotnet.Script.Tests
{
[Collection("IntegrationTests")]
+ // Removed duplicate
public class ScriptExecutionTests
{
public ScriptExecutionTests(ITestOutputHelper testOutputHelper)
@@ -464,14 +465,14 @@ public void ShouldIgnoreGlobalJsonInScriptFolder()
[Fact]
public void ShouldIsolateScriptAssemblies()
{
- var (output, _) = ScriptTestRunner.Default.ExecuteFixture("Isolation", "--isolated-load-context");
+ var (output, _) = ScriptTestRunner.Default.ExecuteFixture("Isolation");
Assert.Contains("2.0.0.0", output);
}
[Fact]
public void ShouldSetCurrentContextualReflectionContext()
{
- var (output, _) = ScriptTestRunner.Default.ExecuteFixture("CurrentContextualReflectionContext", "--isolated-load-context");
+ var (output, _) = ScriptTestRunner.Default.ExecuteFixture("CurrentContextualReflectionContext");
Assert.Contains("Dotnet.Script.Core.ScriptAssemblyLoadContext", output);
}
@@ -483,7 +484,7 @@ public void ShouldCompileAndExecuteWithWebSdk()
Assert.Equal(0, processResult.ExitCode);
}
#endif
-
+
#if NET7_0
[Fact]
public void ShouldCompileAndExecuteWithWebSdk()
@@ -491,8 +492,8 @@ public void ShouldCompileAndExecuteWithWebSdk()
var processResult = ScriptTestRunner.Default.ExecuteFixture("WebApi", "--no-cache");
Assert.Equal(0, processResult.ExitCode);
}
-#endif
-
+#endif
+
#if NET8_0
// .NET 8.0 only works with isolated load context
[Fact]
@@ -501,8 +502,8 @@ public void ShouldCompileAndExecuteWithWebSdk()
var processResult = ScriptTestRunner.Default.ExecuteFixture("WebApi", "--no-cache");
Assert.Equal(0, processResult.ExitCode);
}
-#endif
-
+#endif
+
[Fact]
public void ShouldThrowExceptionWhenSdkIsNotSupported()
{
diff --git a/src/Dotnet.Script.Tests/ScriptFilesResolverTests.cs b/src/Dotnet.Script.Tests/ScriptFilesResolverTests.cs
index 4d47e02b..55544772 100644
--- a/src/Dotnet.Script.Tests/ScriptFilesResolverTests.cs
+++ b/src/Dotnet.Script.Tests/ScriptFilesResolverTests.cs
@@ -5,6 +5,7 @@
namespace Dotnet.Script.Tests
{
+ [Collection("IntegrationTests")]
public class ScriptFilesResolverTests
{
[Fact]
diff --git a/src/Dotnet.Script.Tests/ScriptParserTests.cs b/src/Dotnet.Script.Tests/ScriptParserTests.cs
index 2c361d3e..6853d5de 100644
--- a/src/Dotnet.Script.Tests/ScriptParserTests.cs
+++ b/src/Dotnet.Script.Tests/ScriptParserTests.cs
@@ -8,6 +8,7 @@
namespace Dotnet.Script.Tests
{
+ [Collection("IntegrationTests")]
public class ScriptParserTests
{
private readonly ScriptEnvironment _scriptEnvironment;
@@ -41,7 +42,7 @@ public void ShouldResolveSingleVersionlessPackage(string code)
Assert.Equal(1, result.PackageReferences.Count);
Assert.Equal("Package", result.PackageReferences.Single().Id.Value);
- Assert.Equal(string.Empty, result.PackageReferences.Single().Version.Value);
+ Assert.Equal("*", result.PackageReferences.Single().Version.Value);
}
[Fact]
diff --git a/src/Dotnet.Script.Tests/ScriptPublisherTests.cs b/src/Dotnet.Script.Tests/ScriptPublisherTests.cs
index 80da0361..7272598d 100644
--- a/src/Dotnet.Script.Tests/ScriptPublisherTests.cs
+++ b/src/Dotnet.Script.Tests/ScriptPublisherTests.cs
@@ -10,6 +10,7 @@
namespace Dotnet.Script.Tests
{
+ [Collection("IntegrationTests")]
public class ScriptPublisherTests
{
private readonly ScriptEnvironment _scriptEnvironment;
diff --git a/src/Dotnet.Script.Tests/ScriptRunnerTests.cs b/src/Dotnet.Script.Tests/ScriptRunnerTests.cs
index 90523e29..fb70c6fa 100644
--- a/src/Dotnet.Script.Tests/ScriptRunnerTests.cs
+++ b/src/Dotnet.Script.Tests/ScriptRunnerTests.cs
@@ -10,6 +10,7 @@
namespace Dotnet.Script.Tests
{
+ [Collection("IntegrationTests")]
public class ScriptRunnerTests
{
[Fact]
diff --git a/src/Dotnet.Script.Tests/ScriptTestRunner.cs b/src/Dotnet.Script.Tests/ScriptTestRunner.cs
index 02db0fe5..2406a227 100644
--- a/src/Dotnet.Script.Tests/ScriptTestRunner.cs
+++ b/src/Dotnet.Script.Tests/ScriptTestRunner.cs
@@ -4,9 +4,11 @@
using System.Linq;
using Dotnet.Script.DependencyModel.Environment;
using Dotnet.Script.Shared.Tests;
+using Xunit;
namespace Dotnet.Script.Tests
{
+ [Collection("IntegrationTests")]
public class ScriptTestRunner
{
public static readonly ScriptTestRunner Default = new ScriptTestRunner();
diff --git a/src/Dotnet.Script.Tests/ScriptdependencyContextReaderTests.cs b/src/Dotnet.Script.Tests/ScriptdependencyContextReaderTests.cs
index 401fe96f..039f4dff 100644
--- a/src/Dotnet.Script.Tests/ScriptdependencyContextReaderTests.cs
+++ b/src/Dotnet.Script.Tests/ScriptdependencyContextReaderTests.cs
@@ -8,6 +8,7 @@
namespace Dotnet.Script.Tests
{
+ [Collection("IntegrationTests")]
public class ScriptDependencyContextReaderTests
{
public ScriptDependencyContextReaderTests(ITestOutputHelper testOutputHelper)
@@ -19,9 +20,18 @@ public ScriptDependencyContextReaderTests(ITestOutputHelper testOutputHelper)
public void ShouldThrowMeaningfulExceptionWhenRuntimeTargetIsMissing()
{
using var projectFolder = new DisposableFolder();
- ProcessHelper.RunAndCaptureOutput("dotnet", "new console -n SampleLibrary", projectFolder.Path);
- ProcessHelper.RunAndCaptureOutput("dotnet", "restore", projectFolder.Path);
var pathToAssetsFile = Path.Combine(projectFolder.Path, "SampleLibrary", "obj", "project.assets.json");
+ var result = ProcessHelper.RunAndCaptureOutput("dotnet", "new console -n SampleLibrary", projectFolder.Path);
+ //Assert.Equal(0, result.ExitCode);
+ //result = ProcessHelper.RunAndCaptureOutput("dotnet", "restore", projectFolder.Path);
+ //Assert.Equal(0, result.ExitCode);
+
+ if (!File.Exists(pathToAssetsFile))
+ {
+ throw new InvalidOperationException($"Expected assets file to be present at '{pathToAssetsFile}' but it was not found. Command output: {result.Output}");
+ }
+
+ TestOutputHelper.Current.TestOutputHelper.WriteLine($"Path to assets file: {pathToAssetsFile}");
var dependencyResolver = new ScriptDependencyContextReader(TestOutputHelper.CreateTestLogFactory());
var exception = Assert.Throws(() => dependencyResolver.ReadDependencyContext(pathToAssetsFile));
@@ -31,7 +41,7 @@ public void ShouldThrowMeaningfulExceptionWhenRuntimeTargetIsMissing()
[Fact]
public void ShouldThrowMeaningfulExceptionWhenPassingAnInvalidAssetsFile()
{
- var pathToAssetsFile = Path.Combine(Path.GetTempPath(),"project.assets.json");
+ var pathToAssetsFile = Path.Combine(Path.GetTempPath(), "project.assets.json");
var dependencyResolver = new ScriptDependencyContextReader(TestOutputHelper.CreateTestLogFactory());
var exception = Assert.Throws(() => dependencyResolver.ReadDependencyContext(pathToAssetsFile));
Assert.Contains("Make sure that the file exists and that it is a valid 'project.assets.json' file.", exception.Message);
diff --git a/src/Dotnet.Script.Tests/TestFixtures/NativeLibrary/NativeLibrary.csx b/src/Dotnet.Script.Tests/TestFixtures/NativeLibrary/NativeLibrary.csx
index e0111766..557d6e47 100644
--- a/src/Dotnet.Script.Tests/TestFixtures/NativeLibrary/NativeLibrary.csx
+++ b/src/Dotnet.Script.Tests/TestFixtures/NativeLibrary/NativeLibrary.csx
@@ -1,4 +1,4 @@
-#r "nuget:Microsoft.Data.SQLite, 2.0.0"
+#r "nuget:Microsoft.Data.SQLite, 9.0.10"
using Microsoft.Data.Sqlite;
diff --git a/src/Dotnet.Script.Tests/VersioningTests.cs b/src/Dotnet.Script.Tests/VersioningTests.cs
index 346ed3ca..c53f3f51 100644
--- a/src/Dotnet.Script.Tests/VersioningTests.cs
+++ b/src/Dotnet.Script.Tests/VersioningTests.cs
@@ -12,6 +12,7 @@
namespace Dotnet.Script.Tests
{
+ [Collection("IntegrationTests")]
public class VersioningTests
{
public VersioningTests(ITestOutputHelper testOutputHelper) => testOutputHelper.Capture();
@@ -20,7 +21,7 @@ public class VersioningTests
public void ShouldGetCurrentVersion()
{
var versionProvider = new LoggedVersionProvider(TestOutputHelper.CreateTestLogFactory());
-
+
var result = versionProvider.GetCurrentVersion();
Assert.NotNull(result);
@@ -30,7 +31,7 @@ public void ShouldGetCurrentVersion()
public async Task ShouldGetLatestVersion()
{
var versionProvider = new LoggedVersionProvider(TestOutputHelper.CreateTestLogFactory());
-
+
var result = await versionProvider.GetLatestVersion();
Assert.NotNull(result);
@@ -39,14 +40,14 @@ public async Task ShouldGetLatestVersion()
[Fact]
public async Task ShouldReportAboutNewVersion()
{
- var output = await ReportWith("X","Y");
+ var output = await ReportWith("X", "Y");
Assert.Contains("Version Y is now available", output.ToString());
}
[Fact]
public async Task ShouldNotReportLatestVersionWhenAlreayRunningLatest()
{
- var output = await ReportWith("Y","Y");
+ var output = await ReportWith("Y", "Y");
Assert.DoesNotContain("Version Y is now available", output.ToString());
}
@@ -57,9 +58,9 @@ private static async Task ReportWith(string currentVersion, string lates
versionProviderMock.Setup(m => m.GetLatestVersion()).ReturnsAsync(new VersionInfo(latestVersion, true));
StringWriter output = new StringWriter();
- StringWriter error = new StringWriter();
- ScriptConsole scriptConsole = new ScriptConsole(output, StringReader.Null, error);
- var reporter = new EnvironmentReporter(versionProviderMock.Object,scriptConsole,ScriptEnvironment.Default);
+ StringWriter error = new StringWriter();
+ ScriptConsole scriptConsole = new ScriptConsole(output, StringReader.Null, error);
+ var reporter = new EnvironmentReporter(versionProviderMock.Object, scriptConsole, ScriptEnvironment.Default);
await reporter.ReportInfo();
@@ -87,6 +88,6 @@ Logger logFactory(Type type) => (level, message, exception) =>
await reporter.ReportInfo();
Assert.Contains("Failed to retrieve information about the latest version", log.ToString());
- }
+ }
}
}
\ No newline at end of file
diff --git a/src/Dotnet.Script/Dotnet.Script.csproj b/src/Dotnet.Script/Dotnet.Script.csproj
index b66cb74a..dee8c17b 100644
--- a/src/Dotnet.Script/Dotnet.Script.csproj
+++ b/src/Dotnet.Script/Dotnet.Script.csproj
@@ -5,7 +5,7 @@
1.7.0
filipw
Dotnet.Script
- net9.0;net8.0
+ net10.0;net9.0;net8.0
portable
dotnet-script
Exe
@@ -27,6 +27,7 @@
+
diff --git a/src/Dotnet.Script/Program.cs b/src/Dotnet.Script/Program.cs
index e50c6d89..c0b0ac3d 100644
--- a/src/Dotnet.Script/Program.cs
+++ b/src/Dotnet.Script/Program.cs
@@ -66,10 +66,10 @@ private static int Wain(string[] args)
var configuration = app.Option("-c | --configuration ", "Configuration to use for running the script [Release/Debug] Default is \"Debug\"", CommandOptionType.SingleValue);
var packageSources = app.Option("-s | --sources ", "Specifies a NuGet package source to use when resolving NuGet packages.", CommandOptionType.MultipleValue);
var cachePath = app.Option("-p | --cache-path ", "Specify the temporary directory that the script is built in.", CommandOptionType.SingleValue);
- var debugMode = app.Option(DebugFlagShort + " | " + DebugFlagLong, "Enables debug output.", CommandOptionType.NoValue);
+ var debugMode = app.Option(DebugFlagShort + " | " + DebugFlagLong, "Enables debug output.", CommandOptionType.NoValue);
var verbosity = app.Option("--verbosity", " Set the verbosity level of the command. Allowed values are t[trace], d[ebug], i[nfo], w[arning], e[rror], and c[ritical].", CommandOptionType.SingleValue);
var nocache = app.Option("--no-cache", "Disable caching (Restore and Dll cache)", CommandOptionType.NoValue);
- var isolatedLoadContext = app.Option("--isolated-load-context", "Use isolated assembly load context", CommandOptionType.NoValue);
+ var disableIsolatedLoadContext = app.Option("--disable-isolated-load-context", "Disables isolated assembly load context", CommandOptionType.NoValue);
var infoOption = app.Option("--info", "Displays environmental information", CommandOptionType.NoValue);
var argsBeforeDoubleHyphen = args.TakeWhile(a => a != "--").ToArray();
@@ -237,7 +237,9 @@ private static int Wain(string[] args)
}
AssemblyLoadContext assemblyLoadContext = null;
- if (isolatedLoadContext.HasValue())
+
+
+ if (!disableIsolatedLoadContext.HasValue())
assemblyLoadContext = new ScriptAssemblyLoadContext();
if (scriptFile.HasValue)
@@ -254,7 +256,7 @@ private static int Wain(string[] args)
optimizationLevel,
packageSources.Values?.ToArray(),
interactive.HasValue(),
- cachePath.Value(),
+ cachePath.Value(),
nocache.HasValue()
)
{
@@ -264,7 +266,7 @@ private static int Wain(string[] args)
var fileCommand = new ExecuteScriptCommand(ScriptConsole.Default, logFactory);
var result = await fileCommand.Run(fileCommandOptions);
if (Environment.ExitCode != 0) return Environment.ExitCode;
-
+
return result;
}