From 4cfcae0e76ce245be10d4678e95841ae3de71617 Mon Sep 17 00:00:00 2001 From: filipw Date: Tue, 31 Jan 2023 16:21:55 +0100 Subject: [PATCH 01/45] fixed deprecated syntax --- omnisharp.json | 2 +- src/Dotnet.Script.Core/Internal/PreprocessorLineRewriter.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/omnisharp.json b/omnisharp.json index 93c5d8d9..973aa4c7 100644 --- a/omnisharp.json +++ b/omnisharp.json @@ -8,7 +8,7 @@ }, "script": { "enableScriptNuGetReferences": true, - "defaultTargetFramework": "net5.0" + "defaultTargetFramework": "net6.0" }, "FormattingOptions": { "organizeImports": true, diff --git a/src/Dotnet.Script.Core/Internal/PreprocessorLineRewriter.cs b/src/Dotnet.Script.Core/Internal/PreprocessorLineRewriter.cs index a6658ab8..e2d88866 100644 --- a/src/Dotnet.Script.Core/Internal/PreprocessorLineRewriter.cs +++ b/src/Dotnet.Script.Core/Internal/PreprocessorLineRewriter.cs @@ -25,10 +25,10 @@ public override SyntaxNode VisitReferenceDirectiveTrivia(ReferenceDirectiveTrivi private static SyntaxNode HandleSkippedTrivia(SyntaxNode node) { var skippedTrivia = node.DescendantTrivia().Where(x => x.RawKind == (int)SyntaxKind.SkippedTokensTrivia).FirstOrDefault(); - if (skippedTrivia.Token.Kind() != SyntaxKind.None) + if (!skippedTrivia.Token.IsKind(SyntaxKind.None)) { var firstToken = skippedTrivia.GetStructure().ChildTokens().FirstOrDefault(); - if (firstToken.Kind() == SyntaxKind.BadToken && firstToken.ToFullString().Trim() == ";") + if (firstToken.IsKind(SyntaxKind.BadToken) && firstToken.ToFullString().Trim() == ";") { node = node.ReplaceToken(firstToken, SyntaxFactory.Token(SyntaxKind.None)); skippedTrivia = node.DescendantTrivia().Where(x => x.RawKind == (int)SyntaxKind.SkippedTokensTrivia).FirstOrDefault(); From a5b2d0340385c376e4be780fac78048c54b5f942 Mon Sep 17 00:00:00 2001 From: filipw Date: Tue, 31 Jan 2023 16:41:45 +0100 Subject: [PATCH 02/45] allow DOTNET_SCRIPT_CACHE_LOCATION to be relative --- .../ProjectSystem/FileUtils.cs | 9 +++- src/Dotnet.Script.Tests/FileUtilsTests.cs | 42 +++++++++++++++++++ .../NuGetSourceReferenceResolverTests.cs | 3 +- 3 files changed, 50 insertions(+), 4 deletions(-) create mode 100644 src/Dotnet.Script.Tests/FileUtilsTests.cs diff --git a/src/Dotnet.Script.DependencyModel/ProjectSystem/FileUtils.cs b/src/Dotnet.Script.DependencyModel/ProjectSystem/FileUtils.cs index aa52c14a..37c37e7c 100644 --- a/src/Dotnet.Script.DependencyModel/ProjectSystem/FileUtils.cs +++ b/src/Dotnet.Script.DependencyModel/ProjectSystem/FileUtils.cs @@ -1,9 +1,9 @@ -using Dotnet.Script.DependencyModel.Environment; -using System; +using System; using System.Collections.Generic; using System.IO; using System.Runtime.InteropServices; using System.Text; +using Dotnet.Script.DependencyModel.Environment; using SysEnvironment = System.Environment; namespace Dotnet.Script.DependencyModel.ProjectSystem @@ -51,8 +51,13 @@ public static string GetTempPath() { // prefer the custom env variable if set var cachePath = SysEnvironment.GetEnvironmentVariable("DOTNET_SCRIPT_CACHE_LOCATION"); + if (!string.IsNullOrEmpty(cachePath)) { + if (!Path.IsPathRooted(cachePath)) + { + cachePath = Path.Combine(Directory.GetCurrentDirectory(), cachePath); + } return cachePath; } diff --git a/src/Dotnet.Script.Tests/FileUtilsTests.cs b/src/Dotnet.Script.Tests/FileUtilsTests.cs new file mode 100644 index 00000000..8a2267ab --- /dev/null +++ b/src/Dotnet.Script.Tests/FileUtilsTests.cs @@ -0,0 +1,42 @@ +using System; +using System.IO; +using Dotnet.Script.DependencyModel.ProjectSystem; +using Xunit; + +namespace Dotnet.Script.Tests +{ + public class FileUtilsTests + { + [Fact] + public void GetTempPathCanBeOverridenWithAbsolutePathViaEnvVar() + { + var path = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); + try + { + Environment.SetEnvironmentVariable("DOTNET_SCRIPT_CACHE_LOCATION", path); + var tempPath = FileUtils.GetTempPath(); + Assert.Equal(path, tempPath); + } + finally + { + Environment.SetEnvironmentVariable("DOTNET_SCRIPT_CACHE_LOCATION", null); + } + } + + [Fact] + public void GetTempPathCanBeOverridenWithRelativePathViaEnvVar() + { + var path = "foo"; + try + { + Environment.SetEnvironmentVariable("DOTNET_SCRIPT_CACHE_LOCATION", path); + var tempPath = FileUtils.GetTempPath(); + Assert.Equal(Path.Combine(Directory.GetCurrentDirectory(), path), tempPath); + } + 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 20ad3161..82578387 100644 --- a/src/Dotnet.Script.Tests/NuGetSourceReferenceResolverTests.cs +++ b/src/Dotnet.Script.Tests/NuGetSourceReferenceResolverTests.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Collections.Immutable; using System.IO; using System.Text; From 92a605e549af97ba619f9e173b7a1f4a9f0e395b Mon Sep 17 00:00:00 2001 From: filipw Date: Tue, 31 Jan 2023 16:42:12 +0100 Subject: [PATCH 03/45] extra comment --- src/Dotnet.Script.DependencyModel/ProjectSystem/FileUtils.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Dotnet.Script.DependencyModel/ProjectSystem/FileUtils.cs b/src/Dotnet.Script.DependencyModel/ProjectSystem/FileUtils.cs index 37c37e7c..b23a0d1a 100644 --- a/src/Dotnet.Script.DependencyModel/ProjectSystem/FileUtils.cs +++ b/src/Dotnet.Script.DependencyModel/ProjectSystem/FileUtils.cs @@ -54,6 +54,7 @@ public static string GetTempPath() if (!string.IsNullOrEmpty(cachePath)) { + // if the path is not absolute, make it relative to the current folder if (!Path.IsPathRooted(cachePath)) { cachePath = Path.Combine(Directory.GetCurrentDirectory(), cachePath); From 41af419ee5b101f68702852b00f96724a23c36ed Mon Sep 17 00:00:00 2001 From: filipw Date: Mon, 3 Apr 2023 13:45:39 +0200 Subject: [PATCH 04/45] respect environment.exitcode --- src/Dotnet.Script.Tests/ScriptExecutionTests.cs | 7 +++++++ .../EnvironmentExitCode/EnvironmentExitCode.csx | 2 ++ src/Dotnet.Script/Program.cs | 6 +++++- 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 src/Dotnet.Script.Tests/TestFixtures/EnvironmentExitCode/EnvironmentExitCode.csx diff --git a/src/Dotnet.Script.Tests/ScriptExecutionTests.cs b/src/Dotnet.Script.Tests/ScriptExecutionTests.cs index c8947d33..5c08518e 100644 --- a/src/Dotnet.Script.Tests/ScriptExecutionTests.cs +++ b/src/Dotnet.Script.Tests/ScriptExecutionTests.cs @@ -493,6 +493,13 @@ public void ShouldThrowExceptionWhenSdkIsNotSupported() Assert.StartsWith("The sdk 'Unsupported' is not supported", processResult.StandardError); } + [Fact] + public void ShouldRespectEnvironmentExitCodeOfTheScript() + { + var processResult = ScriptTestRunner.Default.ExecuteFixture("EnvironmentExitCode", "--no-cache"); + Assert.Equal(0xA0, processResult.ExitCode); + } + private static string CreateTestScript(string scriptFolder) { string script = @" diff --git a/src/Dotnet.Script.Tests/TestFixtures/EnvironmentExitCode/EnvironmentExitCode.csx b/src/Dotnet.Script.Tests/TestFixtures/EnvironmentExitCode/EnvironmentExitCode.csx new file mode 100644 index 00000000..ab8f26d5 --- /dev/null +++ b/src/Dotnet.Script.Tests/TestFixtures/EnvironmentExitCode/EnvironmentExitCode.csx @@ -0,0 +1,2 @@ +Environment.ExitCode = 0xA0; +Console.WriteLine("Hello World"); \ No newline at end of file diff --git a/src/Dotnet.Script/Program.cs b/src/Dotnet.Script/Program.cs index ff77a012..f24db369 100644 --- a/src/Dotnet.Script/Program.cs +++ b/src/Dotnet.Script/Program.cs @@ -258,7 +258,11 @@ private static int Wain(string[] args) }; var fileCommand = new ExecuteScriptCommand(ScriptConsole.Default, logFactory); - return await fileCommand.Run(fileCommandOptions); + var result = await fileCommand.Run(fileCommandOptions); + if (Environment.ExitCode != 0) return Environment.ExitCode; + + return result; + } else { From 4d2c67ae920f5fc9151d4f2b37128f090041191b Mon Sep 17 00:00:00 2001 From: Atif Aziz Date: Mon, 22 May 2023 06:29:44 +0200 Subject: [PATCH 05/45] Fix greedy parsing of load directive part --- .../ProjectSystem/ScriptFilesResolver.cs | 2 +- src/Dotnet.Script.Tests/ScriptFilesResolverTests.cs | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Dotnet.Script.DependencyModel/ProjectSystem/ScriptFilesResolver.cs b/src/Dotnet.Script.DependencyModel/ProjectSystem/ScriptFilesResolver.cs index 16d2119d..740acbad 100644 --- a/src/Dotnet.Script.DependencyModel/ProjectSystem/ScriptFilesResolver.cs +++ b/src/Dotnet.Script.DependencyModel/ProjectSystem/ScriptFilesResolver.cs @@ -61,7 +61,7 @@ private void Process(string csxFile, HashSet result) private static string[] GetLoadDirectives(string content) { - var matches = Regex.Matches(content, @"^\s*#load\s*""\s*(.+)\s*""", RegexOptions.Multiline); + var matches = Regex.Matches(content, @"^\s*#load\s*""\s*(.+?)\s*""", RegexOptions.Multiline); List result = new List(); foreach (var match in matches.Cast()) { diff --git a/src/Dotnet.Script.Tests/ScriptFilesResolverTests.cs b/src/Dotnet.Script.Tests/ScriptFilesResolverTests.cs index d7faf92d..4d47e02b 100644 --- a/src/Dotnet.Script.Tests/ScriptFilesResolverTests.cs +++ b/src/Dotnet.Script.Tests/ScriptFilesResolverTests.cs @@ -21,11 +21,15 @@ public void ShouldOnlyResolveRootScript() Assert.Contains(files, f => f.Contains("Foo.csx")); Assert.Contains(files, f => !f.Contains("Bar.csx")); } - [Fact] - public void ShouldResolveLoadedScriptInRootFolder() + + [Theory] + [InlineData("#load \"Bar.csx\"")] + // See: https://github.com/dotnet-script/dotnet-script/issues/720 (1) + [InlineData("#load \"Bar.csx\"\n\n\"Hello world\".Dump();")] + public void ShouldResolveLoadedScriptInRootFolder(string rootScriptContent) { using var rootFolder = new DisposableFolder(); - var rootScript = WriteScript("#load \"Bar.csx\"", rootFolder.Path, "Foo.csx"); + var rootScript = WriteScript(rootScriptContent, rootFolder.Path, "Foo.csx"); WriteScript(string.Empty, rootFolder.Path, "Bar.csx"); var scriptFilesResolver = new ScriptFilesResolver(); From f09136c6a98797f60756ed2b1fb7d1ecf1956c5c Mon Sep 17 00:00:00 2001 From: isaacvale <4448394+isaacvale@users.noreply.github.com> Date: Thu, 25 May 2023 13:21:50 +0200 Subject: [PATCH 06/45] Remove hardwired return type, push up to Program.cs and pass generic type --- src/Dotnet.Script.Core/Commands/ExecuteScriptCommand.cs | 6 +++--- src/Dotnet.Script.Core/Commands/PublishCommand.cs | 6 +++--- src/Dotnet.Script/Program.cs | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Dotnet.Script.Core/Commands/ExecuteScriptCommand.cs b/src/Dotnet.Script.Core/Commands/ExecuteScriptCommand.cs index 4b3b176a..0712495a 100644 --- a/src/Dotnet.Script.Core/Commands/ExecuteScriptCommand.cs +++ b/src/Dotnet.Script.Core/Commands/ExecuteScriptCommand.cs @@ -31,7 +31,7 @@ public async Task Run(ExecuteScriptCommandOptions optio return await DownloadAndRunCode(options); } - var pathToLibrary = GetLibrary(options); + var pathToLibrary = GetLibrary(options); var libraryOptions = new ExecuteLibraryCommandOptions(pathToLibrary, options.Arguments, options.NoCache) { @@ -50,7 +50,7 @@ private async Task DownloadAndRunCode(ExecuteScriptCommandOpti return await new ExecuteCodeCommand(_scriptConsole, _logFactory).Execute(options); } - private string GetLibrary(ExecuteScriptCommandOptions executeOptions) + private string GetLibrary(ExecuteScriptCommandOptions executeOptions) { var projectFolder = FileUtils.GetPathToScriptTempFolder(executeOptions.File.Path); var executionCacheFolder = Path.Combine(projectFolder, "execution-cache"); @@ -70,7 +70,7 @@ private string GetLibrary(ExecuteScriptCommandOptions executeOptions) AssemblyLoadContext = executeOptions.AssemblyLoadContext #endif }; - new PublishCommand(_scriptConsole, _logFactory).Execute(options); + new PublishCommand(_scriptConsole, _logFactory).Execute(options); if (hash != null) { File.WriteAllText(Path.Combine(executionCacheFolder, "script.sha256"), hash); diff --git a/src/Dotnet.Script.Core/Commands/PublishCommand.cs b/src/Dotnet.Script.Core/Commands/PublishCommand.cs index 7e5311eb..5e470b1d 100644 --- a/src/Dotnet.Script.Core/Commands/PublishCommand.cs +++ b/src/Dotnet.Script.Core/Commands/PublishCommand.cs @@ -17,7 +17,7 @@ public PublishCommand(ScriptConsole scriptConsole, LogFactory logFactory) _logFactory = logFactory; } - public void Execute(PublishCommandOptions options) + public void Execute(PublishCommandOptions options) { var absoluteFilePath = options.File.Path; @@ -41,11 +41,11 @@ public void Execute(PublishCommandOptions options) if (options.PublishType == PublishType.Library) { - publisher.CreateAssembly(context, _logFactory, options.LibraryName); + publisher.CreateAssembly(context, _logFactory, options.LibraryName); } else { - publisher.CreateExecutable(context, _logFactory, options.RuntimeIdentifier, options.LibraryName); + publisher.CreateExecutable(context, _logFactory, options.RuntimeIdentifier, options.LibraryName); } } } diff --git a/src/Dotnet.Script/Program.cs b/src/Dotnet.Script/Program.cs index f24db369..06edc471 100644 --- a/src/Dotnet.Script/Program.cs +++ b/src/Dotnet.Script/Program.cs @@ -188,7 +188,7 @@ private static int Wain(string[] args) ); var logFactory = CreateLogFactory(verbosity.Value(), debugMode.HasValue()); - new PublishCommand(ScriptConsole.Default, logFactory).Execute(options); + new PublishCommand(ScriptConsole.Default, logFactory).Execute(options); return 0; }); }); From 7df630d3b19c4edf254f56f191066198e9d39a80 Mon Sep 17 00:00:00 2001 From: isaacvale <4448394+isaacvale@users.noreply.github.com> Date: Mon, 5 Jun 2023 19:40:14 +0200 Subject: [PATCH 07/45] Update PublishCommand.cs Keep previous method signature for backwards compatibility --- src/Dotnet.Script.Core/Commands/PublishCommand.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Dotnet.Script.Core/Commands/PublishCommand.cs b/src/Dotnet.Script.Core/Commands/PublishCommand.cs index 5e470b1d..08a09ffb 100644 --- a/src/Dotnet.Script.Core/Commands/PublishCommand.cs +++ b/src/Dotnet.Script.Core/Commands/PublishCommand.cs @@ -17,6 +17,11 @@ public PublishCommand(ScriptConsole scriptConsole, LogFactory logFactory) _logFactory = logFactory; } + public void Execute(PublishCommandOptions options) + { + Execute(options); + } + public void Execute(PublishCommandOptions options) { var absoluteFilePath = options.File.Path; From 28d2a98c528b9c3c4647d049edfe22e9f8812d8a Mon Sep 17 00:00:00 2001 From: Filip W Date: Tue, 6 Jun 2023 14:19:51 +0200 Subject: [PATCH 08/45] added a note about default namespaces --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index 27e2cc13..f67e8cc7 100644 --- a/README.md +++ b/README.md @@ -103,6 +103,19 @@ That is all it takes and we can execute the script. Args are accessible via the dotnet script helloworld.csx ``` +The following namespaces are available in the script implicitly and do not need to be imported explicitly: + + - System + - System.IO + - System.Collections.Generic + - System.Console + - System.Diagnostics + - System.Dynamic + - System.Linq + - System.Linq.Expressions + - System.Text + - System.Threading.Tasks + ### Scaffolding Simply create a folder somewhere on your system and issue the following command. @@ -591,3 +604,4 @@ a.Run(); ## License [MIT License](https://github.com/dotnet-script/dotnet-script/blob/master/LICENSE) + - From cf8458a57180ab0d8ffca7a1d73626cd00a08864 Mon Sep 17 00:00:00 2001 From: Andreas Mosti Date: Tue, 20 Jun 2023 08:01:10 +0200 Subject: [PATCH 09/45] Update prerestore.Dockerfile to dotnet 7 The prerestore.Dockerfile was hanging back on dotnet 5. Bumping it to 7. --- build/prerestore.Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/prerestore.Dockerfile b/build/prerestore.Dockerfile index 4bca3c56..48894424 100644 --- a/build/prerestore.Dockerfile +++ b/build/prerestore.Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:5.0 +FROM mcr.microsoft.com/dotnet/sdk:7.0 # https://www.nuget.org/packages/dotnet-script/ RUN dotnet tool install dotnet-script --tool-path /usr/bin @@ -10,4 +10,4 @@ RUN dotnet tool install dotnet-script --tool-path /usr/bin # docker container. RUN dotnet script eval "Console.WriteLine(\"☑️ Prepared env for offline usage\")" -ENTRYPOINT [ "dotnet", "script" ] \ No newline at end of file +ENTRYPOINT [ "dotnet", "script" ] From ccf29a7485660f371966d09b5815b4cfe87145b2 Mon Sep 17 00:00:00 2001 From: filipw Date: Sun, 5 Nov 2023 17:37:56 +0100 Subject: [PATCH 10/45] added net8.0 target and rev up to 1.5.0 --- src/Dotnet.Script.Core/Dotnet.Script.Core.csproj | 4 ++-- .../Dotnet.Script.DependencyModel.NuGet.csproj | 2 +- .../Dotnet.Script.DependencyModel.csproj | 2 +- src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj | 2 +- src/Dotnet.Script/Dotnet.Script.csproj | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Dotnet.Script.Core/Dotnet.Script.Core.csproj b/src/Dotnet.Script.Core/Dotnet.Script.Core.csproj index 094312d6..31536514 100644 --- a/src/Dotnet.Script.Core/Dotnet.Script.Core.csproj +++ b/src/Dotnet.Script.Core/Dotnet.Script.Core.csproj @@ -2,9 +2,9 @@ A cross platform library allowing you to run C# (CSX) scripts with support for debugging and inline NuGet packages. Based on Roslyn. - 1.4.0 + 1.5.0 filipw - net6.0;netstandard2.0 + net8.0;net7.0;net6.0;netstandard2.0 Dotnet.Script.Core Dotnet.Script.Core script;csx;csharp;roslyn diff --git a/src/Dotnet.Script.DependencyModel.Nuget/Dotnet.Script.DependencyModel.NuGet.csproj b/src/Dotnet.Script.DependencyModel.Nuget/Dotnet.Script.DependencyModel.NuGet.csproj index 448dae7f..20d1b4ab 100644 --- a/src/Dotnet.Script.DependencyModel.Nuget/Dotnet.Script.DependencyModel.NuGet.csproj +++ b/src/Dotnet.Script.DependencyModel.Nuget/Dotnet.Script.DependencyModel.NuGet.csproj @@ -8,7 +8,7 @@ https://github.com/dotnet-script/dotnet-script.git git script;csx;csharp;roslyn;nuget - 1.4.0 + 1.5.0 A MetadataReferenceResolver that allows inline nuget references to be specified in script(csx) files. dotnet-script dotnet-script diff --git a/src/Dotnet.Script.DependencyModel/Dotnet.Script.DependencyModel.csproj b/src/Dotnet.Script.DependencyModel/Dotnet.Script.DependencyModel.csproj index 2d228cf5..f32e05eb 100644 --- a/src/Dotnet.Script.DependencyModel/Dotnet.Script.DependencyModel.csproj +++ b/src/Dotnet.Script.DependencyModel/Dotnet.Script.DependencyModel.csproj @@ -11,7 +11,7 @@ https://github.com/dotnet-script/dotnet-script.git git script;csx;csharp;roslyn;omnisharp - 1.4.0 + 1.5.0 latest true ../dotnet-script.snk diff --git a/src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj b/src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj index 0144d8e3..671dd886 100644 --- a/src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj +++ b/src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj @@ -1,6 +1,6 @@ - net7.0;net6.0 + net8.0;net7.0;net6.0 false true ../dotnet-script.snk diff --git a/src/Dotnet.Script/Dotnet.Script.csproj b/src/Dotnet.Script/Dotnet.Script.csproj index 10f10c13..d016aaa4 100644 --- a/src/Dotnet.Script/Dotnet.Script.csproj +++ b/src/Dotnet.Script/Dotnet.Script.csproj @@ -2,10 +2,10 @@ Dotnet CLI tool allowing you to run C# (CSX) scripts. - 1.4.0 + 1.5.0 filipw Dotnet.Script - net7.0;net6.0 + net8.0;net7.0;net6.0 portable dotnet-script Exe From 79ff2841c0df0791f18c4dc7643c0d7662f7fdcb Mon Sep 17 00:00:00 2001 From: filipw Date: Sun, 5 Nov 2023 17:43:46 +0100 Subject: [PATCH 11/45] fixed global.json and GH workflow --- .github/workflows/main.yml | 9 ++++++--- global.json | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 64f1e6b4..f803924c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -9,11 +9,12 @@ jobs: steps: - uses: actions/checkout@v3 - name: Install .Net Core - uses: actions/setup-dotnet@v2 + uses: actions/setup-dotnet@v3 with: dotnet-version: | 6.0.x 7.0.x + 8.0.x include-prerelease: true - name: Install dotnet-script run: dotnet tool install dotnet-script --global @@ -27,11 +28,12 @@ jobs: steps: - uses: actions/checkout@v3 - name: Install .Net Core - uses: actions/setup-dotnet@v2 + uses: actions/setup-dotnet@v3 with: dotnet-version: | 6.0.x 7.0.x + 8.0.x include-prerelease: true - name: Install dotnet-script run: dotnet tool install dotnet-script --global @@ -45,11 +47,12 @@ jobs: steps: - uses: actions/checkout@v3 - name: Install .Net Core - uses: actions/setup-dotnet@v2 + uses: actions/setup-dotnet@v3 with: dotnet-version: | 6.0.x 7.0.x + 8.0.x include-prerelease: true - name: Install dotnet-script run: dotnet tool install dotnet-script --global diff --git a/global.json b/global.json index d4d08251..570112b6 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "7.0.100", + "version": "8.0.100-rc.2.23502.2", "rollForward": "latestFeature" } } From 52eb904d36fcfb4c438f5d7d7138a23a4141d813 Mon Sep 17 00:00:00 2001 From: filipw Date: Mon, 6 Nov 2023 13:39:57 +0100 Subject: [PATCH 12/45] fixed several tests --- .../InteractiveRunnerTests.cs | 3 +-- src/Dotnet.Script.Tests/ScriptExecutionTests.cs | 17 +++++++++++++++++ .../TestFixtures/WebApi/WebApi.csx | 6 ++++-- .../TestFixtures/WebApiNet6/WebApiNet6.csx | 6 ++++++ 4 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 src/Dotnet.Script.Tests/TestFixtures/WebApiNet6/WebApiNet6.csx diff --git a/src/Dotnet.Script.Tests/InteractiveRunnerTests.cs b/src/Dotnet.Script.Tests/InteractiveRunnerTests.cs index eba5ff06..da5e3b7f 100644 --- a/src/Dotnet.Script.Tests/InteractiveRunnerTests.cs +++ b/src/Dotnet.Script.Tests/InteractiveRunnerTests.cs @@ -19,8 +19,7 @@ public async Task ShouldCompileAndExecuteWithWebSdk() { @"#r ""sdk:Microsoft.NET.Sdk.Web""", "using Microsoft.AspNetCore.Builder;", - "var a = WebApplication.Create();", - @"a.GetType()", + @"typeof(WebApplication)", "#exit" }; diff --git a/src/Dotnet.Script.Tests/ScriptExecutionTests.cs b/src/Dotnet.Script.Tests/ScriptExecutionTests.cs index 5c08518e..05ecbd0b 100644 --- a/src/Dotnet.Script.Tests/ScriptExecutionTests.cs +++ b/src/Dotnet.Script.Tests/ScriptExecutionTests.cs @@ -1,5 +1,7 @@ using System; using System.IO; +using System.Reflection; +using System.Runtime.InteropServices; using System.Text; using Dotnet.Script.DependencyModel.Environment; using Dotnet.Script.Shared.Tests; @@ -479,12 +481,27 @@ public void ShouldSetCurrentContextualReflectionContext() Assert.Contains("Dotnet.Script.Core.ScriptAssemblyLoadContext", output); } +#if NET6_0 + [Fact] + public void ShouldCompileAndExecuteWithWebSdk() + { + var processResult = ScriptTestRunner.Default.ExecuteFixture("WebApiNet6", "--no-cache"); + Assert.Equal(0, processResult.ExitCode); + } +#endif + +#if NET7_0 [Fact] public void ShouldCompileAndExecuteWithWebSdk() { var processResult = ScriptTestRunner.Default.ExecuteFixture("WebApi", "--no-cache"); Assert.Equal(0, processResult.ExitCode); } +#endif + // todo: the same test should run for .NET 8.0 - currently it fails with + // System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. + // ---> System.IO.FileLoadException: Could not load file or assembly 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. + // Could not find or load a specific file. (0x80131621) [Fact] public void ShouldThrowExceptionWhenSdkIsNotSupported() diff --git a/src/Dotnet.Script.Tests/TestFixtures/WebApi/WebApi.csx b/src/Dotnet.Script.Tests/TestFixtures/WebApi/WebApi.csx index b4b76d41..ff851bad 100644 --- a/src/Dotnet.Script.Tests/TestFixtures/WebApi/WebApi.csx +++ b/src/Dotnet.Script.Tests/TestFixtures/WebApi/WebApi.csx @@ -2,5 +2,7 @@ using Microsoft.AspNetCore.Builder; -var a = WebApplication.Create(); -a.MapGet("/", () => "Hello world"); \ No newline at end of file +var builder = WebApplication.CreateBuilder(); +var app = builder.Build(); + +app.MapGet("/", () => "Hello World!"); \ No newline at end of file diff --git a/src/Dotnet.Script.Tests/TestFixtures/WebApiNet6/WebApiNet6.csx b/src/Dotnet.Script.Tests/TestFixtures/WebApiNet6/WebApiNet6.csx new file mode 100644 index 00000000..b4b76d41 --- /dev/null +++ b/src/Dotnet.Script.Tests/TestFixtures/WebApiNet6/WebApiNet6.csx @@ -0,0 +1,6 @@ +#r "sdk:Microsoft.NET.Sdk.Web" + +using Microsoft.AspNetCore.Builder; + +var a = WebApplication.Create(); +a.MapGet("/", () => "Hello world"); \ No newline at end of file From b282f4905069e45f4c916bddf6f2ea26ff98a2f0 Mon Sep 17 00:00:00 2001 From: filipw Date: Mon, 6 Nov 2023 13:42:19 +0100 Subject: [PATCH 13/45] added true --- src/Dotnet.Script.DependencyModel/ProjectSystem/csproj.template | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Dotnet.Script.DependencyModel/ProjectSystem/csproj.template b/src/Dotnet.Script.DependencyModel/ProjectSystem/csproj.template index 43ef3971..8bfbcffb 100644 --- a/src/Dotnet.Script.DependencyModel/ProjectSystem/csproj.template +++ b/src/Dotnet.Script.DependencyModel/ProjectSystem/csproj.template @@ -3,6 +3,7 @@ Exe net5.0 latest + true From 3c5cd8b48a389b0d6b2cc4d5f3802eb7968b1724 Mon Sep 17 00:00:00 2001 From: filipw Date: Mon, 6 Nov 2023 13:47:20 +0100 Subject: [PATCH 14/45] for .net 8.0 use portable identifiers --- .../Environment/ScriptEnvironment.cs | 6 ++++++ .../ProjectSystem/csproj.template | 1 - src/Dotnet.Script.Tests/ScriptPublisherTests.cs | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Dotnet.Script.DependencyModel/Environment/ScriptEnvironment.cs b/src/Dotnet.Script.DependencyModel/Environment/ScriptEnvironment.cs index afb6591e..2b6de442 100644 --- a/src/Dotnet.Script.DependencyModel/Environment/ScriptEnvironment.cs +++ b/src/Dotnet.Script.DependencyModel/Environment/ScriptEnvironment.cs @@ -133,10 +133,16 @@ private static string GetProcessArchitecture() private static string GetRuntimeIdentifier() { var platformIdentifier = GetPlatformIdentifier(); + +#if NET8_0 + return $"{platformIdentifier}-{GetProcessArchitecture()}"; +#endif + if (platformIdentifier == "osx" || platformIdentifier == "linux") { return $"{platformIdentifier}-{GetProcessArchitecture()}"; } + var runtimeIdentifier = RuntimeEnvironment.GetRuntimeIdentifier(); return runtimeIdentifier; } diff --git a/src/Dotnet.Script.DependencyModel/ProjectSystem/csproj.template b/src/Dotnet.Script.DependencyModel/ProjectSystem/csproj.template index 8bfbcffb..43ef3971 100644 --- a/src/Dotnet.Script.DependencyModel/ProjectSystem/csproj.template +++ b/src/Dotnet.Script.DependencyModel/ProjectSystem/csproj.template @@ -3,7 +3,6 @@ Exe net5.0 latest - true diff --git a/src/Dotnet.Script.Tests/ScriptPublisherTests.cs b/src/Dotnet.Script.Tests/ScriptPublisherTests.cs index 0f7064ef..80da0361 100644 --- a/src/Dotnet.Script.Tests/ScriptPublisherTests.cs +++ b/src/Dotnet.Script.Tests/ScriptPublisherTests.cs @@ -49,7 +49,11 @@ public void SimplePublishTest() public void SimplePublishTestToDifferentRuntimeId() { using var workspaceFolder = new DisposableFolder(); +#if NET8_0 + var runtimeId = _scriptEnvironment.RuntimeIdentifier == "win-x64" ? "osx-x64" : "win10-x64"; +#else var runtimeId = _scriptEnvironment.RuntimeIdentifier == "win10-x64" ? "osx-x64" : "win10-x64"; +#endif var code = @"WriteLine(""hello world"");"; var mainPath = Path.Combine(workspaceFolder.Path, "main.csx"); File.WriteAllText(mainPath, code); From 331b4c1b88204e7da19b569631a2694cf89ab1c5 Mon Sep 17 00:00:00 2001 From: filipw Date: Mon, 6 Nov 2023 14:26:33 +0100 Subject: [PATCH 15/45] use UseRidGraph to allow cross runtime compilation (probably we can do it better in the future) --- src/Dotnet.Script.DependencyModel/ProjectSystem/csproj.template | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Dotnet.Script.DependencyModel/ProjectSystem/csproj.template b/src/Dotnet.Script.DependencyModel/ProjectSystem/csproj.template index 43ef3971..8bfbcffb 100644 --- a/src/Dotnet.Script.DependencyModel/ProjectSystem/csproj.template +++ b/src/Dotnet.Script.DependencyModel/ProjectSystem/csproj.template @@ -3,6 +3,7 @@ Exe net5.0 latest + true From a44d71ffb1a10c17601c99171dbb23b4ed3d367c Mon Sep 17 00:00:00 2001 From: filipw Date: Thu, 9 Nov 2023 13:08:57 +0100 Subject: [PATCH 16/45] added isolated loadcontext to .NET 8.0 SDK test --- .../ScriptExecutionTests.cs | 18 ++++++++++++------ .../TestFixtures/WebApi/WebApi.csx | 1 + 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/Dotnet.Script.Tests/ScriptExecutionTests.cs b/src/Dotnet.Script.Tests/ScriptExecutionTests.cs index 05ecbd0b..995a8b9c 100644 --- a/src/Dotnet.Script.Tests/ScriptExecutionTests.cs +++ b/src/Dotnet.Script.Tests/ScriptExecutionTests.cs @@ -497,12 +497,18 @@ public void ShouldCompileAndExecuteWithWebSdk() var processResult = ScriptTestRunner.Default.ExecuteFixture("WebApi", "--no-cache"); Assert.Equal(0, processResult.ExitCode); } -#endif - // todo: the same test should run for .NET 8.0 - currently it fails with - // System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. - // ---> System.IO.FileLoadException: Could not load file or assembly 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. - // Could not find or load a specific file. (0x80131621) - +#endif + +#if NET8_0 + // .NET 8.0 only works with isolated load context + [Fact] + public void ShouldCompileAndExecuteWithWebSdk() + { + var processResult = ScriptTestRunner.Default.ExecuteFixture("WebApi", "--no-cache --isolated-load-context"); + Assert.Equal(0, processResult.ExitCode); + } +#endif + [Fact] public void ShouldThrowExceptionWhenSdkIsNotSupported() { diff --git a/src/Dotnet.Script.Tests/TestFixtures/WebApi/WebApi.csx b/src/Dotnet.Script.Tests/TestFixtures/WebApi/WebApi.csx index ff851bad..29658f1b 100644 --- a/src/Dotnet.Script.Tests/TestFixtures/WebApi/WebApi.csx +++ b/src/Dotnet.Script.Tests/TestFixtures/WebApi/WebApi.csx @@ -1,4 +1,5 @@ #r "sdk:Microsoft.NET.Sdk.Web" +#r "nuget:Microsoft.Extensions.DependencyInjection.Abstractions, 8.0.0-rc.2.23479.6" using Microsoft.AspNetCore.Builder; From b34c2c7f42f86757e98c7a8f1ee253d8359087b6 Mon Sep 17 00:00:00 2001 From: filipw Date: Mon, 13 Nov 2023 15:50:51 +0100 Subject: [PATCH 17/45] conditionally reference appropriate version of Microsoft.Extensions.Logging.Console --- src/Dotnet.Script.Tests/ScriptExecutionTests.cs | 2 +- src/Dotnet.Script/Dotnet.Script.csproj | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Dotnet.Script.Tests/ScriptExecutionTests.cs b/src/Dotnet.Script.Tests/ScriptExecutionTests.cs index 995a8b9c..8bb5fd96 100644 --- a/src/Dotnet.Script.Tests/ScriptExecutionTests.cs +++ b/src/Dotnet.Script.Tests/ScriptExecutionTests.cs @@ -504,7 +504,7 @@ public void ShouldCompileAndExecuteWithWebSdk() [Fact] public void ShouldCompileAndExecuteWithWebSdk() { - var processResult = ScriptTestRunner.Default.ExecuteFixture("WebApi", "--no-cache --isolated-load-context"); + var processResult = ScriptTestRunner.Default.ExecuteFixture("WebApi", "--no-cache"); Assert.Equal(0, processResult.ExitCode); } #endif diff --git a/src/Dotnet.Script/Dotnet.Script.csproj b/src/Dotnet.Script/Dotnet.Script.csproj index d016aaa4..f7af5ba1 100644 --- a/src/Dotnet.Script/Dotnet.Script.csproj +++ b/src/Dotnet.Script/Dotnet.Script.csproj @@ -27,7 +27,11 @@ - + + + From 35fb1e522e0a067f5efac5ba42de391d3806f71a Mon Sep 17 00:00:00 2001 From: filipw Date: Tue, 14 Nov 2023 15:21:13 +0100 Subject: [PATCH 18/45] updated to latest Roslyn 4.8.0-3.final --- src/Dotnet.Script.Core/Dotnet.Script.Core.csproj | 2 +- src/Dotnet.Script.Core/ScriptPublisher.cs | 2 +- .../Dotnet.Script.DependencyModel.NuGet.csproj | 2 +- src/Dotnet.Script.Extras/Dotnet.Script.Extras.csproj | 4 ++-- src/Dotnet.Script/Dotnet.Script.csproj | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Dotnet.Script.Core/Dotnet.Script.Core.csproj b/src/Dotnet.Script.Core/Dotnet.Script.Core.csproj index 31536514..fc33ff5d 100644 --- a/src/Dotnet.Script.Core/Dotnet.Script.Core.csproj +++ b/src/Dotnet.Script.Core/Dotnet.Script.Core.csproj @@ -26,7 +26,7 @@ - + diff --git a/src/Dotnet.Script.Core/ScriptPublisher.cs b/src/Dotnet.Script.Core/ScriptPublisher.cs index 78b51f1d..15452b66 100644 --- a/src/Dotnet.Script.Core/ScriptPublisher.cs +++ b/src/Dotnet.Script.Core/ScriptPublisher.cs @@ -11,7 +11,7 @@ namespace Dotnet.Script.Core { public class ScriptPublisher { - private const string ScriptingVersion = "4.4.0-1.final"; + private const string ScriptingVersion = "4.8.0-3.final"; private readonly ScriptProjectProvider _scriptProjectProvider; private readonly ScriptEmitter _scriptEmitter; diff --git a/src/Dotnet.Script.DependencyModel.Nuget/Dotnet.Script.DependencyModel.NuGet.csproj b/src/Dotnet.Script.DependencyModel.Nuget/Dotnet.Script.DependencyModel.NuGet.csproj index 20d1b4ab..5d81c138 100644 --- a/src/Dotnet.Script.DependencyModel.Nuget/Dotnet.Script.DependencyModel.NuGet.csproj +++ b/src/Dotnet.Script.DependencyModel.Nuget/Dotnet.Script.DependencyModel.NuGet.csproj @@ -21,6 +21,6 @@ - + diff --git a/src/Dotnet.Script.Extras/Dotnet.Script.Extras.csproj b/src/Dotnet.Script.Extras/Dotnet.Script.Extras.csproj index 19a9fd9b..60cc7930 100644 --- a/src/Dotnet.Script.Extras/Dotnet.Script.Extras.csproj +++ b/src/Dotnet.Script.Extras/Dotnet.Script.Extras.csproj @@ -12,8 +12,8 @@ - - + + diff --git a/src/Dotnet.Script/Dotnet.Script.csproj b/src/Dotnet.Script/Dotnet.Script.csproj index f7af5ba1..f25255a8 100644 --- a/src/Dotnet.Script/Dotnet.Script.csproj +++ b/src/Dotnet.Script/Dotnet.Script.csproj @@ -25,7 +25,7 @@ ../dotnet-script.snk - + From 9d199f1716ac4bf8d2291efc58b637d1202a1558 Mon Sep 17 00:00:00 2001 From: filipw Date: Tue, 14 Nov 2023 15:21:26 +0100 Subject: [PATCH 19/45] use preview lang version in interactive runner --- src/Dotnet.Script.Core/Interactive/InteractiveRunner.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Dotnet.Script.Core/Interactive/InteractiveRunner.cs b/src/Dotnet.Script.Core/Interactive/InteractiveRunner.cs index 99473fd5..4ffcecf4 100644 --- a/src/Dotnet.Script.Core/Interactive/InteractiveRunner.cs +++ b/src/Dotnet.Script.Core/Interactive/InteractiveRunner.cs @@ -26,7 +26,7 @@ public class InteractiveRunner protected ScriptCompiler ScriptCompiler; protected ScriptConsole Console; private readonly string[] _packageSources; - protected CSharpParseOptions ParseOptions = new CSharpParseOptions(LanguageVersion.Latest, kind: SourceCodeKind.Script); + protected CSharpParseOptions ParseOptions = new CSharpParseOptions(LanguageVersion.Preview, kind: SourceCodeKind.Script); protected InteractiveCommandProvider InteractiveCommandParser = new InteractiveCommandProvider(); protected string CurrentDirectory = Directory.GetCurrentDirectory(); From 35d023e44a7f91446d35607d44bca133ad6d1990 Mon Sep 17 00:00:00 2001 From: filipw Date: Tue, 14 Nov 2023 19:56:19 +0100 Subject: [PATCH 20/45] updated to .NET 8 stable --- global.json | 2 +- src/Dotnet.Script.Tests/TestFixtures/WebApi/WebApi.csx | 1 - src/Dotnet.Script/Dotnet.Script.csproj | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/global.json b/global.json index 570112b6..090e95c7 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "8.0.100-rc.2.23502.2", + "version": "8.0.100", "rollForward": "latestFeature" } } diff --git a/src/Dotnet.Script.Tests/TestFixtures/WebApi/WebApi.csx b/src/Dotnet.Script.Tests/TestFixtures/WebApi/WebApi.csx index 29658f1b..ff851bad 100644 --- a/src/Dotnet.Script.Tests/TestFixtures/WebApi/WebApi.csx +++ b/src/Dotnet.Script.Tests/TestFixtures/WebApi/WebApi.csx @@ -1,5 +1,4 @@ #r "sdk:Microsoft.NET.Sdk.Web" -#r "nuget:Microsoft.Extensions.DependencyInjection.Abstractions, 8.0.0-rc.2.23479.6" using Microsoft.AspNetCore.Builder; diff --git a/src/Dotnet.Script/Dotnet.Script.csproj b/src/Dotnet.Script/Dotnet.Script.csproj index f25255a8..67bb0123 100644 --- a/src/Dotnet.Script/Dotnet.Script.csproj +++ b/src/Dotnet.Script/Dotnet.Script.csproj @@ -30,7 +30,7 @@ - From 7c125d48efb2426c9904e3f152a798fa5ffa051e Mon Sep 17 00:00:00 2001 From: Filip W Date: Wed, 15 Nov 2023 08:40:24 +0100 Subject: [PATCH 21/45] added .NET 8.0 to the README --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f67e8cc7..87a31cb9 100644 --- a/README.md +++ b/README.md @@ -10,9 +10,9 @@ Run C# scripts from the .NET CLI, define NuGet packages inline and edit/debug th | Name | Version | Framework(s) | | ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------- | -| `dotnet-script` (global tool) | [![Nuget](http://img.shields.io/nuget/v/dotnet-script.svg?maxAge=10800)](https://www.nuget.org/packages/dotnet-script/) | `net6.0`, `net7.0` | -| `Dotnet.Script` (CLI as Nuget) | [![Nuget](http://img.shields.io/nuget/v/dotnet.script.svg?maxAge=10800)](https://www.nuget.org/packages/dotnet.script/) | `net6.0`, `net7.0` | -| `Dotnet.Script.Core` | [![Nuget](http://img.shields.io/nuget/v/Dotnet.Script.Core.svg?maxAge=10800)](https://www.nuget.org/packages/Dotnet.Script.Core/) | `net6.0` , `netstandard2.0` | +| `dotnet-script` (global tool) | [![Nuget](http://img.shields.io/nuget/v/dotnet-script.svg?maxAge=10800)](https://www.nuget.org/packages/dotnet-script/) | `net6.0`,`net7.0`,`net8.0` | +| `Dotnet.Script` (CLI as Nuget) | [![Nuget](http://img.shields.io/nuget/v/dotnet.script.svg?maxAge=10800)](https://www.nuget.org/packages/dotnet.script/) | `net6.0`,`net7.0`,`net8.0` | +| `Dotnet.Script.Core` | [![Nuget](http://img.shields.io/nuget/v/Dotnet.Script.Core.svg?maxAge=10800)](https://www.nuget.org/packages/Dotnet.Script.Core/) | `net6.0`,`net7.0`,`net8.0`,`netstandard2.0` | | `Dotnet.Script.DependencyModel` | [![Nuget](http://img.shields.io/nuget/v/Dotnet.Script.DependencyModel.svg?maxAge=10800)](https://www.nuget.org/packages/Dotnet.Script.DependencyModel/) | `netstandard2.0` | | `Dotnet.Script.DependencyModel.Nuget` | [![Nuget](http://img.shields.io/nuget/v/Dotnet.Script.DependencyModel.Nuget.svg?maxAge=10800)](https://www.nuget.org/packages/Dotnet.Script.DependencyModel.Nuget/) | `netstandard2.0` | @@ -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 6.0 or .Net 7.0](https://www.microsoft.com/net/download/core). +The only thing we need to install is [.NET 6.0, .NET 7.0 or .NET 8.0 SDK](https://dotnet.microsoft.com/en-us/download/dotnet). ### .NET Core Global Tool From 8a81057268d52cae09b1f3b6c2f269fb83f9eb9a Mon Sep 17 00:00:00 2001 From: filipw Date: Mon, 6 May 2024 09:04:09 +0200 Subject: [PATCH 22/45] fixed global tool path detection --- .gitignore | 1 + src/Dotnet.Script.Core/Scaffolder.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 860e9507..62f574c6 100644 --- a/.gitignore +++ b/.gitignore @@ -266,3 +266,4 @@ project.json /dotnet-script /.vscode /src/Dotnet.Script/Properties/launchSettings.json +.DS_Store diff --git a/src/Dotnet.Script.Core/Scaffolder.cs b/src/Dotnet.Script.Core/Scaffolder.cs index b07e911e..c7966ed8 100644 --- a/src/Dotnet.Script.Core/Scaffolder.cs +++ b/src/Dotnet.Script.Core/Scaffolder.cs @@ -141,7 +141,7 @@ private void CreateLaunchConfiguration(string currentWorkingDirectory) _scriptConsole.WriteNormal("Creating VS Code launch configuration file"); string pathToLaunchFile = Path.Combine(vsCodeDirectory, "launch.json"); string installLocation = _scriptEnvironment.InstallLocation; - bool isInstalledAsGlobalTool = installLocation.Contains(".dotnet/tools", StringComparison.OrdinalIgnoreCase); + bool isInstalledAsGlobalTool = installLocation.Contains($".dotnet{Path.DirectorySeparatorChar}tools", StringComparison.OrdinalIgnoreCase); string dotnetScriptPath = Path.Combine(installLocation, "dotnet-script.dll").Replace(@"\", "/"); string launchFileContent; if (!File.Exists(pathToLaunchFile)) From 64eab8f8318c71aead12677324047074ed23347f Mon Sep 17 00:00:00 2001 From: filipw Date: Mon, 6 May 2024 16:19:20 +0200 Subject: [PATCH 23/45] fixed Windows tests --- src/Dotnet.Script.Tests/ScaffoldingTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Dotnet.Script.Tests/ScaffoldingTests.cs b/src/Dotnet.Script.Tests/ScaffoldingTests.cs index 6051ac73..8335de59 100644 --- a/src/Dotnet.Script.Tests/ScaffoldingTests.cs +++ b/src/Dotnet.Script.Tests/ScaffoldingTests.cs @@ -179,7 +179,7 @@ public void ShouldUpdatePathToDotnetScript() [Fact] public void ShouldCreateUnifiedLaunchFileWhenInstalledAsGlobalTool() { - Scaffolder scaffolder = CreateTestScaffolder("somefolder/.dotnet/tools/dotnet-script"); + Scaffolder scaffolder = CreateTestScaffolder($"somefolder{Path.DirectorySeparatorChar}.dotnet{Path.DirectorySeparatorChar}tools{Path.DirectorySeparatorChar}dotnet-script"); using var scriptFolder = new DisposableFolder(); scaffolder.InitializerFolder("main.csx", scriptFolder.Path); @@ -191,7 +191,7 @@ public void ShouldCreateUnifiedLaunchFileWhenInstalledAsGlobalTool() public void ShouldUpdateToUnifiedLaunchFileWhenInstalledAsGlobalTool() { Scaffolder scaffolder = CreateTestScaffolder("some-install-folder"); - Scaffolder globalToolScaffolder = CreateTestScaffolder("somefolder/.dotnet/tools/dotnet-script"); + Scaffolder globalToolScaffolder = CreateTestScaffolder($"somefolder{Path.DirectorySeparatorChar}.dotnet{Path.DirectorySeparatorChar}tools{Path.DirectorySeparatorChar}dotnet-script"); using var scriptFolder = new DisposableFolder(); scaffolder.InitializerFolder("main.csx", scriptFolder.Path); var fileContent = File.ReadAllText(Path.Combine(scriptFolder.Path, ".vscode", "launch.json")); From b8f4136263a97ed0743f97080647e878fd1e92fb Mon Sep 17 00:00:00 2001 From: Filip W Date: Tue, 7 May 2024 13:37:40 +0200 Subject: [PATCH 24/45] Update main.yml use macos-13 for now --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f803924c..d1097e20 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,7 +23,7 @@ jobs: run: dotnet-script build/Build.csx build-mac: - runs-on: macos-latest + runs-on: macos-13 steps: - uses: actions/checkout@v3 From 9844fc77770edce27b6153a07be4142d80671b14 Mon Sep 17 00:00:00 2001 From: filipw Date: Tue, 7 May 2024 20:47:51 +0200 Subject: [PATCH 25/45] do not use tinyurl in tests --- src/Dotnet.Script.Tests/ScriptExecutionTests.cs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/Dotnet.Script.Tests/ScriptExecutionTests.cs b/src/Dotnet.Script.Tests/ScriptExecutionTests.cs index 8bb5fd96..f42a4a3a 100644 --- a/src/Dotnet.Script.Tests/ScriptExecutionTests.cs +++ b/src/Dotnet.Script.Tests/ScriptExecutionTests.cs @@ -250,7 +250,9 @@ public void ShouldSupportInlineNugetReferencesWithTrailingSemicoloninEvaluatedCo [Theory] [InlineData("https://gist.githubusercontent.com/seesharper/5d6859509ea8364a1fdf66bbf5b7923d/raw/0a32bac2c3ea807f9379a38e251d93e39c8131cb/HelloWorld.csx", - "Hello World")] + "Hello World")] + [InlineData("http://gist.githubusercontent.com/seesharper/5d6859509ea8364a1fdf66bbf5b7923d/raw/0a32bac2c3ea807f9379a38e251d93e39c8131cb/HelloWorld.csx", + "Hello World")] [InlineData("https://github.com/dotnet-script/dotnet-script/files/5035247/hello.csx.gz", "Hello, world!")] public void ShouldExecuteRemoteScript(string url, string output) @@ -259,14 +261,6 @@ public void ShouldExecuteRemoteScript(string url, string output) Assert.Contains(output, result.Output); } - [Fact] - public void ShouldExecuteRemoteScriptUsingTinyUrl() - { - var url = "https://tinyurl.com/y8cda9zt"; - var (output, _) = ScriptTestRunner.Default.Execute(url); - Assert.Contains("Hello World", output); - } - [Fact] public void ShouldHandleIssue268() { From 4add1b89808bcacc94fbdd5175efc5ed563b4fca Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 9 Jul 2024 21:39:33 +0000 Subject: [PATCH 26/45] Bump System.Text.Json from 7.0.0 to 8.0.4 in /src/Dotnet.Script.Core Bumps System.Text.Json from 7.0.0 to 8.0.4. --- updated-dependencies: - dependency-name: System.Text.Json dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- src/Dotnet.Script.Core/Dotnet.Script.Core.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Dotnet.Script.Core/Dotnet.Script.Core.csproj b/src/Dotnet.Script.Core/Dotnet.Script.Core.csproj index fc33ff5d..6d202df0 100644 --- a/src/Dotnet.Script.Core/Dotnet.Script.Core.csproj +++ b/src/Dotnet.Script.Core/Dotnet.Script.Core.csproj @@ -31,7 +31,7 @@ - + From 8f5ab6409a7e9fd2c91a29f8738881408f8c31b0 Mon Sep 17 00:00:00 2001 From: Dorian Date: Thu, 1 Aug 2024 10:03:12 +0300 Subject: [PATCH 27/45] Fixes #758 - manual install of dotnet note --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 87a31cb9..c5bbc109 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,9 @@ Run C# scripts from the .NET CLI, define NuGet packages inline and edit/debug th The only thing we need to install is [.NET 6.0, .NET 7.0 or .NET 8.0 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 + ### .NET Core Global Tool .NET Core 2.1 introduced the concept of global tools meaning that you can install `dotnet-script` using nothing but the .NET CLI. From 7f33e6a7ab43ef5c596534ba1dbd3860ff4d16a9 Mon Sep 17 00:00:00 2001 From: Tom Laird-McConnell Date: Sun, 18 Aug 2024 09:41:26 -0700 Subject: [PATCH 28/45] dotnet script register doesn't work if VSCode has registered for the .csx extension. --- src/Dotnet.Script.Core/Scaffolder.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Dotnet.Script.Core/Scaffolder.cs b/src/Dotnet.Script.Core/Scaffolder.cs index c7966ed8..8e52acc1 100644 --- a/src/Dotnet.Script.Core/Scaffolder.cs +++ b/src/Dotnet.Script.Core/Scaffolder.cs @@ -81,6 +81,7 @@ public void RegisterFileHandler() if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { // register dotnet-script as the tool to process .csx files + _commandRunner.Execute("reg", @"delete HKCU\Software\classes\.csx /f"); _commandRunner.Execute("reg", @"add HKCU\Software\classes\.csx /f /ve /t REG_SZ /d dotnetscript"); _commandRunner.Execute("reg", $@"add HKCU\Software\Classes\dotnetscript\Shell\Open\Command /f /ve /t REG_EXPAND_SZ /d ""\""%ProgramFiles%\dotnet\dotnet.exe\"" script \""%1\"" -- %*"""); } From df73e88830774699b3f1f5b16a9ea7051977b5ee Mon Sep 17 00:00:00 2001 From: Joshua Brink Date: Sun, 8 Sep 2024 23:07:16 +0200 Subject: [PATCH 29/45] Fixes #723 shebang before sdk --- .../ProjectSystem/ScriptParser.cs | 2 +- .../ScriptProjectProviderTests.cs | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Dotnet.Script.DependencyModel/ProjectSystem/ScriptParser.cs b/src/Dotnet.Script.DependencyModel/ProjectSystem/ScriptParser.cs index 0d058a21..9222a220 100644 --- a/src/Dotnet.Script.DependencyModel/ProjectSystem/ScriptParser.cs +++ b/src/Dotnet.Script.DependencyModel/ProjectSystem/ScriptParser.cs @@ -53,7 +53,7 @@ public ParseResult ParseFromFiles(IEnumerable csxFiles) private static string ReadSdkFromReferenceDirective(string fileContent) { const string pattern = DirectivePatternPrefix + "r" + SdkDirectivePatternSuffix; - var match = Regex.Match(fileContent, pattern); + var match = Regex.Match(fileContent, pattern, RegexOptions.Multiline); if (match.Success) { var sdk = match.Groups[1].Value; diff --git a/src/Dotnet.Script.Tests/ScriptProjectProviderTests.cs b/src/Dotnet.Script.Tests/ScriptProjectProviderTests.cs index 9d87775f..fdc3bc03 100644 --- a/src/Dotnet.Script.Tests/ScriptProjectProviderTests.cs +++ b/src/Dotnet.Script.Tests/ScriptProjectProviderTests.cs @@ -40,5 +40,17 @@ public void ShouldUseSpecifiedSdk() var projectFileInfo = provider.CreateProject(TestPathUtils.GetPathToTestFixtureFolder("WebApi"), _scriptEnvironment.TargetFramework, true); Assert.Equal("Microsoft.NET.Sdk.Web", XDocument.Load(projectFileInfo.Path).Descendants("Project").Single().Attributes("Sdk").Single().Value); } + + // See: https://github.com/dotnet-script/dotnet-script/issues/723 + [Theory] + [InlineData("#!/usr/bin/env dotnet-script\n#r \"sdk:Microsoft.NET.Sdk.Web\"")] + [InlineData("#!/usr/bin/env dotnet-script\n\n#r \"sdk:Microsoft.NET.Sdk.Web\"")] + public void ShouldHandleShebangBeforeSdk(string code) + { + var parser = new ScriptParser(TestOutputHelper.CreateTestLogFactory()); + var result = parser.ParseFromCode(code); + + Assert.Equal("Microsoft.NET.Sdk.Web", result.Sdk); + } } } \ No newline at end of file From d8a0db434c7d12f0f8164fe5a2d980cfd3fae7dd Mon Sep 17 00:00:00 2001 From: Bernhard Richter Date: Mon, 4 Nov 2024 23:50:11 +0100 Subject: [PATCH 30/45] Initial support for .net 9 --- .github/workflows/main.yml | 9 +++------ global.json | 2 +- src/.vscode/tasks.json | 2 +- src/Dotnet.Script.Core/Dotnet.Script.Core.csproj | 2 +- src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj | 2 +- src/Dotnet.Script/Dotnet.Script.csproj | 10 ++++------ 6 files changed, 11 insertions(+), 16 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d1097e20..1072bdeb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,9 +12,8 @@ jobs: uses: actions/setup-dotnet@v3 with: dotnet-version: | - 6.0.x - 7.0.x 8.0.x + 9.0.x include-prerelease: true - name: Install dotnet-script run: dotnet tool install dotnet-script --global @@ -31,9 +30,8 @@ jobs: uses: actions/setup-dotnet@v3 with: dotnet-version: | - 6.0.x - 7.0.x 8.0.x + 9.0.x include-prerelease: true - name: Install dotnet-script run: dotnet tool install dotnet-script --global @@ -50,9 +48,8 @@ jobs: uses: actions/setup-dotnet@v3 with: dotnet-version: | - 6.0.x - 7.0.x 8.0.x + 9.0.x include-prerelease: true - name: Install dotnet-script run: dotnet tool install dotnet-script --global diff --git a/global.json b/global.json index 090e95c7..bbaf16e9 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "8.0.100", + "version": "9.0.0-rc.2.24473.5", "rollForward": "latestFeature" } } diff --git a/src/.vscode/tasks.json b/src/.vscode/tasks.json index e35e8bda..d778ce8d 100644 --- a/src/.vscode/tasks.json +++ b/src/.vscode/tasks.json @@ -46,7 +46,7 @@ "-c", "release", "-f", - "net7.0", + "net9.0", "${workspaceFolder}/Dotnet.Script.Tests/DotNet.Script.Tests.csproj" ], "problemMatcher": "$msCompile", diff --git a/src/Dotnet.Script.Core/Dotnet.Script.Core.csproj b/src/Dotnet.Script.Core/Dotnet.Script.Core.csproj index 6d202df0..6a486f79 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.5.0 filipw - net8.0;net7.0;net6.0;netstandard2.0 + net9.0;net8.0;netstandard2.0 Dotnet.Script.Core Dotnet.Script.Core script;csx;csharp;roslyn diff --git a/src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj b/src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj index 671dd886..a743d91c 100644 --- a/src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj +++ b/src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj @@ -1,6 +1,6 @@ - net8.0;net7.0;net6.0 + net9.0;net8.0 false true ../dotnet-script.snk diff --git a/src/Dotnet.Script/Dotnet.Script.csproj b/src/Dotnet.Script/Dotnet.Script.csproj index 67bb0123..260c1656 100644 --- a/src/Dotnet.Script/Dotnet.Script.csproj +++ b/src/Dotnet.Script/Dotnet.Script.csproj @@ -5,7 +5,7 @@ 1.5.0 filipw Dotnet.Script - net8.0;net7.0;net6.0 + net9.0;net8.0 portable dotnet-script Exe @@ -27,11 +27,9 @@ - - - + + + From f83e2b6ebec178544eca475a1490e4c9cfe5a348 Mon Sep 17 00:00:00 2001 From: Bernhard Richter Date: Wed, 6 Nov 2024 13:36:39 +0100 Subject: [PATCH 31/45] Bump dotnet.build --- build/Build.csx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/Build.csx b/build/Build.csx index 684f6602..b779a55b 100644 --- a/build/Build.csx +++ b/build/Build.csx @@ -1,4 +1,4 @@ -#load "nuget:Dotnet.Build, 0.7.1" +#load "nuget:Dotnet.Build, 0.23.0 " #load "nuget:dotnet-steps, 0.0.1" #load "nuget:github-changelog, 0.1.5" #load "BuildContext.csx" From 978664c038c8f3b935307599584e3d1360706bc5 Mon Sep 17 00:00:00 2001 From: Bernhard Richter Date: Wed, 6 Nov 2024 13:49:35 +0100 Subject: [PATCH 32/45] Fix pushing Nuget packages --- build/Build.csx | 3 ++- build/BuildContext.csx | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/build/Build.csx b/build/Build.csx index b779a55b..bc0c9b47 100644 --- a/build/Build.csx +++ b/build/Build.csx @@ -86,7 +86,8 @@ private async Task PublishRelease() Git.Default.RequireCleanWorkingTree(); await ReleaseManagerFor(owner, projectName, BuildEnvironment.GitHubAccessToken) .CreateRelease(Git.Default.GetLatestTag(), pathToReleaseNotes, new[] { new ZipReleaseAsset(pathToGitHubReleaseAsset) }); - NuGet.TryPush(nuGetArtifactsFolder); + + DotNet.TryPush(nuGetArtifactsFolder); } } diff --git a/build/BuildContext.csx b/build/BuildContext.csx index 6cf4505b..1cfeeb07 100644 --- a/build/BuildContext.csx +++ b/build/BuildContext.csx @@ -1,4 +1,4 @@ -#load "nuget:Dotnet.Build, 0.7.1" +#load "nuget:Dotnet.Build, 0.23.0" using static FileUtils; using System.Xml.Linq; @@ -7,7 +7,7 @@ const string GlobalToolPackageId = "dotnet-script"; var owner = "filipw"; var projectName = "dotnet-script"; var root = FileUtils.GetScriptFolder(); -var solutionFolder = Path.Combine(root,"..","src"); +var solutionFolder = Path.Combine(root, "..", "src"); var dotnetScriptProjectFolder = Path.Combine(root, "..", "src", "Dotnet.Script"); var dotnetScriptCoreProjectFolder = Path.Combine(root, "..", "src", "Dotnet.Script.Core"); var dotnetScriptDependencyModelProjectFolder = Path.Combine(root, "..", "src", "Dotnet.Script.DependencyModel"); From ac494732385e80fdaee3eabe886ddd423e2472f3 Mon Sep 17 00:00:00 2001 From: Rob E Date: Thu, 7 Nov 2024 21:16:01 +1000 Subject: [PATCH 33/45] Update Dotnet.Script.DependencyModel.csproj Bump `NuGet.ProjectModel` to `6.2.4` Resolves CVEs https://msrc.microsoft.com/update-guide/vulnerability/CVE-2022-41032 https://msrc.microsoft.com/update-guide/vulnerability/CVE-2023-29337 --- .../Dotnet.Script.DependencyModel.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Dotnet.Script.DependencyModel/Dotnet.Script.DependencyModel.csproj b/src/Dotnet.Script.DependencyModel/Dotnet.Script.DependencyModel.csproj index f32e05eb..3d3aa873 100644 --- a/src/Dotnet.Script.DependencyModel/Dotnet.Script.DependencyModel.csproj +++ b/src/Dotnet.Script.DependencyModel/Dotnet.Script.DependencyModel.csproj @@ -32,7 +32,7 @@ - + From 0d7dd22329f325961a15fc9467c23525615587bc Mon Sep 17 00:00:00 2001 From: Bernhard Richter Date: Tue, 12 Nov 2024 00:19:39 +0100 Subject: [PATCH 34/45] Publish .net8 --- build/Build.csx | 4 ++-- build/omnisharp.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build/Build.csx b/build/Build.csx index bc0c9b47..99658e1f 100644 --- a/build/Build.csx +++ b/build/Build.csx @@ -1,4 +1,4 @@ -#load "nuget:Dotnet.Build, 0.23.0 " +#load "nuget:Dotnet.Build, 0.23.0" #load "nuget:dotnet-steps, 0.0.1" #load "nuget:github-changelog, 0.1.5" #load "BuildContext.csx" @@ -33,7 +33,7 @@ await StepRunner.Execute(Args); private void CreateGitHubReleaseAsset() { - DotNet.Publish(dotnetScriptProjectFolder, publishArtifactsFolder, "net6.0"); + DotNet.Publish(dotnetScriptProjectFolder, publishArtifactsFolder, "net8.0"); Zip(publishArchiveFolder, pathToGitHubReleaseAsset); } diff --git a/build/omnisharp.json b/build/omnisharp.json index 74b7fc1b..945a3c21 100644 --- a/build/omnisharp.json +++ b/build/omnisharp.json @@ -1,6 +1,6 @@ { "script": { "enableScriptNuGetReferences": true, - "defaultTargetFramework": "net6.0" + "defaultTargetFramework": "net8.0" } } \ No newline at end of file From 20c3eb3a7d7780203ac9698d4924dcf08d208944 Mon Sep 17 00:00:00 2001 From: Bernhard Richter Date: Tue, 12 Nov 2024 13:48:52 +0100 Subject: [PATCH 35/45] Add test step for windows --- .github/workflows/main.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1072bdeb..ed396be5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -54,6 +54,9 @@ jobs: - name: Install dotnet-script run: dotnet tool install dotnet-script --global + - name: Run tests + run: dotnet test -c release src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj + - name: Run build script run: dotnet-script build/Build.csx env: # Or as an environment variable From bb77c95b5d92c1d595d4b6a9d449660080f06079 Mon Sep 17 00:00:00 2001 From: Bernhard Richter Date: Tue, 12 Nov 2024 14:14:39 +0100 Subject: [PATCH 36/45] Run net9 tests only --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ed396be5..4c013f36 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -55,7 +55,7 @@ jobs: run: dotnet tool install dotnet-script --global - name: Run tests - run: dotnet test -c release src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj + run: dotnet test -c release -f net9 src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj - name: Run build script run: dotnet-script build/Build.csx From e36ed459a214f2bdd2cf1b7f30861d07bb2c1a6e Mon Sep 17 00:00:00 2001 From: Bernhard Richter Date: Tue, 12 Nov 2024 14:21:47 +0100 Subject: [PATCH 37/45] Only run tests for net9 --- src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj b/src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj index a743d91c..159328e9 100644 --- a/src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj +++ b/src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj @@ -1,6 +1,6 @@ - net9.0;net8.0 + net9.0 false true ../dotnet-script.snk From f8fc4165b9ca86555f80d21877c7ef89cb831d74 Mon Sep 17 00:00:00 2001 From: Bernhard Richter Date: Tue, 12 Nov 2024 14:43:32 +0100 Subject: [PATCH 38/45] Run tests for net8.0 and net9.0 in sequence --- .github/workflows/main.yml | 3 --- build/Build.csx | 3 ++- src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4c013f36..1072bdeb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -54,9 +54,6 @@ jobs: - name: Install dotnet-script run: dotnet tool install dotnet-script --global - - name: Run tests - run: dotnet test -c release -f net9 src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj - - name: Run build script run: dotnet-script build/Build.csx env: # Or as an environment variable diff --git a/build/Build.csx b/build/Build.csx index 99658e1f..b1de2829 100644 --- a/build/Build.csx +++ b/build/Build.csx @@ -58,7 +58,8 @@ private void CreateNuGetPackages() private void RunTests() { - DotNet.Test(testProjectFolder); + Command.Execute("dotnet", "test -c release -f net8.0", testProjectFolder); + Command.Execute("dotnet", "test -c release -f net9.0", testProjectFolder); if (BuildEnvironment.IsWindows) { DotNet.Test(testDesktopProjectFolder); diff --git a/src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj b/src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj index 159328e9..a743d91c 100644 --- a/src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj +++ b/src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj @@ -1,6 +1,6 @@ - net9.0 + net9.0;net8.0 false true ../dotnet-script.snk From 529733c3754ece513dec7a3fb16db9337d0edb05 Mon Sep 17 00:00:00 2001 From: Filip W Date: Tue, 12 Nov 2024 15:55:50 +0000 Subject: [PATCH 39/45] case sensitivity for tests --- build/Build.csx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/Build.csx b/build/Build.csx index b1de2829..3aa8a709 100644 --- a/build/Build.csx +++ b/build/Build.csx @@ -58,8 +58,8 @@ private void CreateNuGetPackages() 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 net8.0", testProjectFolder); + Command.Execute("dotnet", "test -c Release -f net9.0", testProjectFolder); if (BuildEnvironment.IsWindows) { DotNet.Test(testDesktopProjectFolder); From bb2b6bcecf3b3a237b7674f4acce0b634b736f73 Mon Sep 17 00:00:00 2001 From: Bernhard Richter Date: Tue, 12 Nov 2024 21:42:51 +0100 Subject: [PATCH 40/45] Bumped deps --- src/Dotnet.Script.Core/Dotnet.Script.Core.csproj | 8 ++++---- .../Dotnet.Script.DependencyModel.NuGet.csproj | 9 ++++----- .../Dotnet.Script.DependencyModel.csproj | 13 ++++--------- .../Dotnet.Script.Desktop.Tests.csproj | 9 +++------ .../Dotnet.Script.Extras.csproj | 12 +++++------- .../Dotnet.Script.Shared.Tests.csproj | 7 ++----- src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj | 1 + src/Dotnet.Script/Dotnet.Script.csproj | 7 +++---- 8 files changed, 26 insertions(+), 40 deletions(-) diff --git a/src/Dotnet.Script.Core/Dotnet.Script.Core.csproj b/src/Dotnet.Script.Core/Dotnet.Script.Core.csproj index 6a486f79..4260d682 100644 --- a/src/Dotnet.Script.Core/Dotnet.Script.Core.csproj +++ b/src/Dotnet.Script.Core/Dotnet.Script.Core.csproj @@ -24,9 +24,9 @@ - - - + + + @@ -38,4 +38,4 @@ - + \ No newline at end of file diff --git a/src/Dotnet.Script.DependencyModel.Nuget/Dotnet.Script.DependencyModel.NuGet.csproj b/src/Dotnet.Script.DependencyModel.Nuget/Dotnet.Script.DependencyModel.NuGet.csproj index 5d81c138..3daa5ba7 100644 --- a/src/Dotnet.Script.DependencyModel.Nuget/Dotnet.Script.DependencyModel.NuGet.csproj +++ b/src/Dotnet.Script.DependencyModel.Nuget/Dotnet.Script.DependencyModel.NuGet.csproj @@ -1,5 +1,5 @@ - - + + netstandard2.0 MIT @@ -16,11 +16,10 @@ true ../dotnet-script.snk - - + - + \ No newline at end of file diff --git a/src/Dotnet.Script.DependencyModel/Dotnet.Script.DependencyModel.csproj b/src/Dotnet.Script.DependencyModel/Dotnet.Script.DependencyModel.csproj index f32e05eb..f2b4fda9 100644 --- a/src/Dotnet.Script.DependencyModel/Dotnet.Script.DependencyModel.csproj +++ b/src/Dotnet.Script.DependencyModel/Dotnet.Script.DependencyModel.csproj @@ -1,5 +1,5 @@ - - + + netstandard2.0 dotnet-script @@ -16,24 +16,19 @@ true ../dotnet-script.snk - - ScriptParser.cs - - - + - - + \ No newline at end of file diff --git a/src/Dotnet.Script.Desktop.Tests/Dotnet.Script.Desktop.Tests.csproj b/src/Dotnet.Script.Desktop.Tests/Dotnet.Script.Desktop.Tests.csproj index cbe23b97..9ffb726d 100644 --- a/src/Dotnet.Script.Desktop.Tests/Dotnet.Script.Desktop.Tests.csproj +++ b/src/Dotnet.Script.Desktop.Tests/Dotnet.Script.Desktop.Tests.csproj @@ -1,5 +1,5 @@ - - + + net472 true @@ -16,17 +16,14 @@ - - PreserveNewest - - + \ No newline at end of file diff --git a/src/Dotnet.Script.Extras/Dotnet.Script.Extras.csproj b/src/Dotnet.Script.Extras/Dotnet.Script.Extras.csproj index 60cc7930..76ea47f6 100644 --- a/src/Dotnet.Script.Extras/Dotnet.Script.Extras.csproj +++ b/src/Dotnet.Script.Extras/Dotnet.Script.Extras.csproj @@ -1,5 +1,5 @@ - - + + Extensions and add ons to C# scripting 0.2.0 @@ -10,10 +10,8 @@ false false - - - + + - - + \ No newline at end of file diff --git a/src/Dotnet.Script.Shared.Tests/Dotnet.Script.Shared.Tests.csproj b/src/Dotnet.Script.Shared.Tests/Dotnet.Script.Shared.Tests.csproj index 2b928e99..b6393d04 100644 --- a/src/Dotnet.Script.Shared.Tests/Dotnet.Script.Shared.Tests.csproj +++ b/src/Dotnet.Script.Shared.Tests/Dotnet.Script.Shared.Tests.csproj @@ -1,18 +1,15 @@ + - netstandard2.0 true ../dotnet-script.snk - - - - + \ No newline at end of file diff --git a/src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj b/src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj index a743d91c..94e4c796 100644 --- a/src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj +++ b/src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj @@ -1,3 +1,4 @@ + net9.0;net8.0 diff --git a/src/Dotnet.Script/Dotnet.Script.csproj b/src/Dotnet.Script/Dotnet.Script.csproj index 260c1656..39413c29 100644 --- a/src/Dotnet.Script/Dotnet.Script.csproj +++ b/src/Dotnet.Script/Dotnet.Script.csproj @@ -25,11 +25,10 @@ ../dotnet-script.snk - + - - - + + From 54d1eb657899e3197eb9d0b6351635c7f2a4f1aa Mon Sep 17 00:00:00 2001 From: Bernhard Richter Date: Tue, 12 Nov 2024 22:01:34 +0100 Subject: [PATCH 41/45] Fixed scriptingversion --- src/Dotnet.Script.Core/ScriptPublisher.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Dotnet.Script.Core/ScriptPublisher.cs b/src/Dotnet.Script.Core/ScriptPublisher.cs index 15452b66..faaf6b05 100644 --- a/src/Dotnet.Script.Core/ScriptPublisher.cs +++ b/src/Dotnet.Script.Core/ScriptPublisher.cs @@ -11,7 +11,7 @@ namespace Dotnet.Script.Core { public class ScriptPublisher { - private const string ScriptingVersion = "4.8.0-3.final"; + private const string ScriptingVersion = "4.11.0"; private readonly ScriptProjectProvider _scriptProjectProvider; private readonly ScriptEmitter _scriptEmitter; @@ -57,7 +57,7 @@ public void CreateAssembly(ScriptContext context, LogFactory log // only display published if we aren't auto publishing to temp folder if (!scriptAssemblyPath.StartsWith(FileUtils.GetTempPath())) { - _scriptConsole.WriteSuccess($"Published {context.FilePath} to { scriptAssemblyPath}"); + _scriptConsole.WriteSuccess($"Published {context.FilePath} to {scriptAssemblyPath}"); } } From bc2cf8c3f4448e33aa90e387e54558aa9648eb35 Mon Sep 17 00:00:00 2001 From: Bernhard Richter Date: Tue, 12 Nov 2024 22:15:44 +0100 Subject: [PATCH 42/45] Bumped more dependencies --- src/Dotnet.Script.Core/Dotnet.Script.Core.csproj | 2 +- src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj | 2 +- src/Dotnet.Script/Dotnet.Script.csproj | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Dotnet.Script.Core/Dotnet.Script.Core.csproj b/src/Dotnet.Script.Core/Dotnet.Script.Core.csproj index 4260d682..c35f0631 100644 --- a/src/Dotnet.Script.Core/Dotnet.Script.Core.csproj +++ b/src/Dotnet.Script.Core/Dotnet.Script.Core.csproj @@ -31,7 +31,7 @@ - + diff --git a/src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj b/src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj index 94e4c796..fe8fa9ed 100644 --- a/src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj +++ b/src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj @@ -18,7 +18,7 @@ runtime; build; native; contentfiles; analyzers - + diff --git a/src/Dotnet.Script/Dotnet.Script.csproj b/src/Dotnet.Script/Dotnet.Script.csproj index 39413c29..df6c3d95 100644 --- a/src/Dotnet.Script/Dotnet.Script.csproj +++ b/src/Dotnet.Script/Dotnet.Script.csproj @@ -26,7 +26,7 @@ - + From b63cab3b7c50e98b6d165a91627b286ef665db87 Mon Sep 17 00:00:00 2001 From: Bernhard Richter Date: Tue, 12 Nov 2024 22:25:22 +0100 Subject: [PATCH 43/45] Bumped more dependencies --- .../Dotnet.Script.Desktop.Tests.csproj | 8 ++++---- .../Dotnet.Script.Shared.Tests.csproj | 2 +- src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Dotnet.Script.Desktop.Tests/Dotnet.Script.Desktop.Tests.csproj b/src/Dotnet.Script.Desktop.Tests/Dotnet.Script.Desktop.Tests.csproj index 9ffb726d..5d609576 100644 --- a/src/Dotnet.Script.Desktop.Tests/Dotnet.Script.Desktop.Tests.csproj +++ b/src/Dotnet.Script.Desktop.Tests/Dotnet.Script.Desktop.Tests.csproj @@ -6,14 +6,14 @@ ../dotnet-script.snk - - - + + + all runtime; build; native; contentfiles; analyzers - + diff --git a/src/Dotnet.Script.Shared.Tests/Dotnet.Script.Shared.Tests.csproj b/src/Dotnet.Script.Shared.Tests/Dotnet.Script.Shared.Tests.csproj index b6393d04..2365de7b 100644 --- a/src/Dotnet.Script.Shared.Tests/Dotnet.Script.Shared.Tests.csproj +++ b/src/Dotnet.Script.Shared.Tests/Dotnet.Script.Shared.Tests.csproj @@ -6,7 +6,7 @@ ../dotnet-script.snk - + diff --git a/src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj b/src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj index fe8fa9ed..4b8b7da5 100644 --- a/src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj +++ b/src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj @@ -11,9 +11,9 @@ runtime; build; native; contentfiles; analyzers all - - - + + + all runtime; build; native; contentfiles; analyzers From a8e9b0024f09ce57773f113089d8a326f2b6a657 Mon Sep 17 00:00:00 2001 From: Filip W Date: Wed, 13 Nov 2024 09:37:10 +0100 Subject: [PATCH 44/45] 9.0.100 --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index bbaf16e9..97614a3d 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "9.0.0-rc.2.24473.5", + "version": "9.0.100", "rollForward": "latestFeature" } } From 6b1d92c5468a6ef830ba1224c48bc6ab3cf10f5f Mon Sep 17 00:00:00 2001 From: Bernhard Richter Date: Wed, 13 Nov 2024 12:42:55 +0100 Subject: [PATCH 45/45] Bumped version numbers and updated docs --- README.md | 16 ++++++++-------- src/Dotnet.Script.Core/Dotnet.Script.Core.csproj | 2 +- .../Dotnet.Script.DependencyModel.NuGet.csproj | 2 +- .../Dotnet.Script.DependencyModel.csproj | 2 +- .../Dotnet.Script.Extras.csproj | 2 +- src/Dotnet.Script/Dotnet.Script.csproj | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index c5bbc109..3482c176 100644 --- a/README.md +++ b/README.md @@ -8,19 +8,19 @@ Run C# scripts from the .NET CLI, define NuGet packages inline and edit/debug th ## NuGet Packages -| Name | Version | Framework(s) | -| ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------- | -| `dotnet-script` (global tool) | [![Nuget](http://img.shields.io/nuget/v/dotnet-script.svg?maxAge=10800)](https://www.nuget.org/packages/dotnet-script/) | `net6.0`,`net7.0`,`net8.0` | -| `Dotnet.Script` (CLI as Nuget) | [![Nuget](http://img.shields.io/nuget/v/dotnet.script.svg?maxAge=10800)](https://www.nuget.org/packages/dotnet.script/) | `net6.0`,`net7.0`,`net8.0` | -| `Dotnet.Script.Core` | [![Nuget](http://img.shields.io/nuget/v/Dotnet.Script.Core.svg?maxAge=10800)](https://www.nuget.org/packages/Dotnet.Script.Core/) | `net6.0`,`net7.0`,`net8.0`,`netstandard2.0` | -| `Dotnet.Script.DependencyModel` | [![Nuget](http://img.shields.io/nuget/v/Dotnet.Script.DependencyModel.svg?maxAge=10800)](https://www.nuget.org/packages/Dotnet.Script.DependencyModel/) | `netstandard2.0` | -| `Dotnet.Script.DependencyModel.Nuget` | [![Nuget](http://img.shields.io/nuget/v/Dotnet.Script.DependencyModel.Nuget.svg?maxAge=10800)](https://www.nuget.org/packages/Dotnet.Script.DependencyModel.Nuget/) | `netstandard2.0` | +| Name | Version | Framework(s) | +| ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------- | +| `dotnet-script` (global tool) | [![Nuget](http://img.shields.io/nuget/v/dotnet-script.svg?maxAge=10800)](https://www.nuget.org/packages/dotnet-script/) | `net8.0`,`net9.0` | +| `Dotnet.Script` (CLI as Nuget) | [![Nuget](http://img.shields.io/nuget/v/dotnet.script.svg?maxAge=10800)](https://www.nuget.org/packages/dotnet.script/) | `net8.0`,`net9.0` | +| `Dotnet.Script.Core` | [![Nuget](http://img.shields.io/nuget/v/Dotnet.Script.Core.svg?maxAge=10800)](https://www.nuget.org/packages/Dotnet.Script.Core/) | `net8.0`,`net9.0`,`netstandard2.0` | +| `Dotnet.Script.DependencyModel` | [![Nuget](http://img.shields.io/nuget/v/Dotnet.Script.DependencyModel.svg?maxAge=10800)](https://www.nuget.org/packages/Dotnet.Script.DependencyModel/) | `netstandard2.0` | +| `Dotnet.Script.DependencyModel.Nuget` | [![Nuget](http://img.shields.io/nuget/v/Dotnet.Script.DependencyModel.Nuget.svg?maxAge=10800)](https://www.nuget.org/packages/Dotnet.Script.DependencyModel.Nuget/) | `netstandard2.0` | ## Installing ### Prerequisites -The only thing we need to install is [.NET 6.0, .NET 7.0 or .NET 8.0 SDK](https://dotnet.microsoft.com/en-us/download/dotnet). +The only thing we need to install is [.NET 8.0 or .NET 9.0 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 diff --git a/src/Dotnet.Script.Core/Dotnet.Script.Core.csproj b/src/Dotnet.Script.Core/Dotnet.Script.Core.csproj index c35f0631..94dd6e45 100644 --- a/src/Dotnet.Script.Core/Dotnet.Script.Core.csproj +++ b/src/Dotnet.Script.Core/Dotnet.Script.Core.csproj @@ -2,7 +2,7 @@ A cross platform library allowing you to run C# (CSX) scripts with support for debugging and inline NuGet packages. Based on Roslyn. - 1.5.0 + 1.6.0 filipw net9.0;net8.0;netstandard2.0 Dotnet.Script.Core diff --git a/src/Dotnet.Script.DependencyModel.Nuget/Dotnet.Script.DependencyModel.NuGet.csproj b/src/Dotnet.Script.DependencyModel.Nuget/Dotnet.Script.DependencyModel.NuGet.csproj index 3daa5ba7..c2794916 100644 --- a/src/Dotnet.Script.DependencyModel.Nuget/Dotnet.Script.DependencyModel.NuGet.csproj +++ b/src/Dotnet.Script.DependencyModel.Nuget/Dotnet.Script.DependencyModel.NuGet.csproj @@ -8,7 +8,7 @@ https://github.com/dotnet-script/dotnet-script.git git script;csx;csharp;roslyn;nuget - 1.5.0 + 1.6.0 A MetadataReferenceResolver that allows inline nuget references to be specified in script(csx) files. dotnet-script dotnet-script diff --git a/src/Dotnet.Script.DependencyModel/Dotnet.Script.DependencyModel.csproj b/src/Dotnet.Script.DependencyModel/Dotnet.Script.DependencyModel.csproj index f2b4fda9..a0be1fb6 100644 --- a/src/Dotnet.Script.DependencyModel/Dotnet.Script.DependencyModel.csproj +++ b/src/Dotnet.Script.DependencyModel/Dotnet.Script.DependencyModel.csproj @@ -11,7 +11,7 @@ https://github.com/dotnet-script/dotnet-script.git git script;csx;csharp;roslyn;omnisharp - 1.5.0 + 1.6.0 latest true ../dotnet-script.snk diff --git a/src/Dotnet.Script.Extras/Dotnet.Script.Extras.csproj b/src/Dotnet.Script.Extras/Dotnet.Script.Extras.csproj index 76ea47f6..c79a5f84 100644 --- a/src/Dotnet.Script.Extras/Dotnet.Script.Extras.csproj +++ b/src/Dotnet.Script.Extras/Dotnet.Script.Extras.csproj @@ -2,7 +2,7 @@ Extensions and add ons to C# scripting - 0.2.0 + 0.3.0 netstandard2.0 Dotnet.Script.Extras Dotnet.Script.Extras diff --git a/src/Dotnet.Script/Dotnet.Script.csproj b/src/Dotnet.Script/Dotnet.Script.csproj index df6c3d95..e33e4619 100644 --- a/src/Dotnet.Script/Dotnet.Script.csproj +++ b/src/Dotnet.Script/Dotnet.Script.csproj @@ -2,7 +2,7 @@ Dotnet CLI tool allowing you to run C# (CSX) scripts. - 1.5.0 + 1.6.0 filipw Dotnet.Script net9.0;net8.0 pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy