From e0fd1a999e9ab2e15093b5ddf010e9dab63c6118 Mon Sep 17 00:00:00 2001 From: Luiz Henrique Cassettari Date: Sat, 17 Feb 2024 10:22:27 -0300 Subject: [PATCH 1/6] Update version to 1.1.0 --- CHANGELOG.md | 5 +++++ RevitAddin.CommandLoader/Revit/App.cs | 3 +-- RevitAddin.CommandLoader/RevitAddin.CommandLoader.csproj | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e93dd04..02be90b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [1.1.0] / 2024-02-17 +### Features +- Support net core plugin. + ## [1.0.6] / 2024-01-27 ### Features - Using `ricaun.Revit.UI.Tasks` @@ -49,6 +53,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - [x] AutoUpdater [vNext]: ../../compare/1.0.0...HEAD +[1.1.0]: ../../compare/1.0.6...1.1.0 [1.0.6]: ../../compare/1.0.5...1.0.6 [1.0.5]: ../../compare/1.0.4...1.0.5 [1.0.4]: ../../compare/1.0.3...1.0.4 diff --git a/RevitAddin.CommandLoader/Revit/App.cs b/RevitAddin.CommandLoader/Revit/App.cs index 975d659..c807e3c 100644 --- a/RevitAddin.CommandLoader/Revit/App.cs +++ b/RevitAddin.CommandLoader/Revit/App.cs @@ -22,12 +22,11 @@ public class App : IExternalApplication private static UIControlledApplication UIControlledApplication; private static RevitTaskService revitTaskService; - public static IRevitTask RevitTask { get; private set; } + public static IRevitTask RevitTask => revitTaskService; public Result OnStartup(UIControlledApplication application) { revitTaskService = new RevitTaskService(application); revitTaskService.Initialize(); - RevitTask = new RevitTask(revitTaskService); UIControlledApplication = application; ribbonPanel = application.CreatePanel("CommandLoader"); diff --git a/RevitAddin.CommandLoader/RevitAddin.CommandLoader.csproj b/RevitAddin.CommandLoader/RevitAddin.CommandLoader.csproj index d54f34b..4d30e8f 100644 --- a/RevitAddin.CommandLoader/RevitAddin.CommandLoader.csproj +++ b/RevitAddin.CommandLoader/RevitAddin.CommandLoader.csproj @@ -89,7 +89,7 @@ RevitAddin.CommandLoader - 1.0.6 + 1.1.0 {82070359-36DA-4441-A59D-9018B6A8B348} From 610c91ac8cee6470a9d64207b46a7e8ef406f74e Mon Sep 17 00:00:00 2001 From: Luiz Henrique Cassettari Date: Sat, 17 Feb 2024 10:41:07 -0300 Subject: [PATCH 2/6] Add `CodeAnalysisCodeDom` to support net code. --- CHANGELOG.md | 2 + .../RevitAddin.CommandLoader.Tests.csproj | 19 ++++- RevitAddin.CommandLoader.sln | 9 +- .../RevitAddin.CommandLoader.csproj | 43 ++++++++-- .../CodeDom/CodeAnalysisCodeDomService.cs | 82 +++++++++++++++++++ .../Services/CodeDomFactory.cs | 5 +- .../Services/GistGithubUtils.cs | 6 +- 7 files changed, 151 insertions(+), 15 deletions(-) create mode 100644 RevitAddin.CommandLoader/Services/CodeDom/CodeAnalysisCodeDomService.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 02be90b..914ca3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [1.1.0] / 2024-02-17 ### Features - Support net core plugin. +### Added +- Add `CodeAnalysisCodeDom` to support net code. ## [1.0.6] / 2024-01-27 ### Features diff --git a/RevitAddin.CommandLoader.Tests/RevitAddin.CommandLoader.Tests.csproj b/RevitAddin.CommandLoader.Tests/RevitAddin.CommandLoader.Tests.csproj index 0b034e0..4d9ffd5 100644 --- a/RevitAddin.CommandLoader.Tests/RevitAddin.CommandLoader.Tests.csproj +++ b/RevitAddin.CommandLoader.Tests/RevitAddin.CommandLoader.Tests.csproj @@ -3,7 +3,7 @@ false Latest - Debug 2017;2017;Debug 2021;2021 + Debug 2017;2017;Debug 2021;2021;2025 @@ -44,12 +44,18 @@ net48 - + - 2023 + 2024 net48 + + + 2025 + net8.0-windows + + 2017 @@ -63,6 +69,13 @@ REVIT$(RevitVersion) + + + true + true + false + + diff --git a/RevitAddin.CommandLoader.sln b/RevitAddin.CommandLoader.sln index 5555dd6..5a5f393 100644 --- a/RevitAddin.CommandLoader.sln +++ b/RevitAddin.CommandLoader.sln @@ -14,12 +14,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution", "Solution", "{E6 README.md = README.md EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RevitAddin.CommandLoader.Tests", "RevitAddin.CommandLoader.Tests\RevitAddin.CommandLoader.Tests.csproj", "{42C706AF-0255-4E98-A5A0-C043FA7B0496}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RevitAddin.CommandLoader.Tests", "RevitAddin.CommandLoader.Tests\RevitAddin.CommandLoader.Tests.csproj", "{42C706AF-0255-4E98-A5A0-C043FA7B0496}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution 2017|Any CPU = 2017|Any CPU 2021|Any CPU = 2021|Any CPU + 2025|Any CPU = 2025|Any CPU Debug 2017|Any CPU = Debug 2017|Any CPU Debug 2021|Any CPU = Debug 2021|Any CPU EndGlobalSection @@ -28,18 +29,24 @@ Global {82070359-36DA-4441-A59D-9018B6A8B348}.2017|Any CPU.Build.0 = 2017|Any CPU {82070359-36DA-4441-A59D-9018B6A8B348}.2021|Any CPU.ActiveCfg = 2021|Any CPU {82070359-36DA-4441-A59D-9018B6A8B348}.2021|Any CPU.Build.0 = 2021|Any CPU + {82070359-36DA-4441-A59D-9018B6A8B348}.2025|Any CPU.ActiveCfg = 2025|Any CPU + {82070359-36DA-4441-A59D-9018B6A8B348}.2025|Any CPU.Build.0 = 2025|Any CPU {82070359-36DA-4441-A59D-9018B6A8B348}.Debug 2017|Any CPU.ActiveCfg = Debug 2017|Any CPU {82070359-36DA-4441-A59D-9018B6A8B348}.Debug 2017|Any CPU.Build.0 = Debug 2017|Any CPU {82070359-36DA-4441-A59D-9018B6A8B348}.Debug 2021|Any CPU.ActiveCfg = Debug 2021|Any CPU {82070359-36DA-4441-A59D-9018B6A8B348}.Debug 2021|Any CPU.Build.0 = Debug 2021|Any CPU {34853418-411C-4B27-82AF-DDE5309AEE10}.2017|Any CPU.ActiveCfg = Release|Any CPU {34853418-411C-4B27-82AF-DDE5309AEE10}.2021|Any CPU.ActiveCfg = Release|Any CPU + {34853418-411C-4B27-82AF-DDE5309AEE10}.2025|Any CPU.ActiveCfg = Debug|Any CPU + {34853418-411C-4B27-82AF-DDE5309AEE10}.2025|Any CPU.Build.0 = Debug|Any CPU {34853418-411C-4B27-82AF-DDE5309AEE10}.Debug 2017|Any CPU.ActiveCfg = Debug|Any CPU {34853418-411C-4B27-82AF-DDE5309AEE10}.Debug 2021|Any CPU.ActiveCfg = Debug|Any CPU {42C706AF-0255-4E98-A5A0-C043FA7B0496}.2017|Any CPU.ActiveCfg = 2017|Any CPU {42C706AF-0255-4E98-A5A0-C043FA7B0496}.2017|Any CPU.Build.0 = 2017|Any CPU {42C706AF-0255-4E98-A5A0-C043FA7B0496}.2021|Any CPU.ActiveCfg = 2021|Any CPU {42C706AF-0255-4E98-A5A0-C043FA7B0496}.2021|Any CPU.Build.0 = 2021|Any CPU + {42C706AF-0255-4E98-A5A0-C043FA7B0496}.2025|Any CPU.ActiveCfg = 2025|Any CPU + {42C706AF-0255-4E98-A5A0-C043FA7B0496}.2025|Any CPU.Build.0 = 2025|Any CPU {42C706AF-0255-4E98-A5A0-C043FA7B0496}.Debug 2017|Any CPU.ActiveCfg = Debug|Any CPU {42C706AF-0255-4E98-A5A0-C043FA7B0496}.Debug 2017|Any CPU.Build.0 = Debug|Any CPU {42C706AF-0255-4E98-A5A0-C043FA7B0496}.Debug 2021|Any CPU.ActiveCfg = Debug 2021|Any CPU diff --git a/RevitAddin.CommandLoader/RevitAddin.CommandLoader.csproj b/RevitAddin.CommandLoader/RevitAddin.CommandLoader.csproj index 4d30e8f..9d94817 100644 --- a/RevitAddin.CommandLoader/RevitAddin.CommandLoader.csproj +++ b/RevitAddin.CommandLoader/RevitAddin.CommandLoader.csproj @@ -8,7 +8,7 @@ latest false None - Debug 2017;2017;Debug 2021;2021 + Debug 2017;2017;Debug 2021;2021;2025 @@ -55,6 +55,18 @@ net48 + + + 2024 + net48 + + + + + 2025 + net8.0-windows + + 2017 @@ -63,6 +75,13 @@ + + + true + true + false + + true @@ -115,9 +134,7 @@ Copyright © $(CopyrightYears) $(Company) - - - + @@ -147,7 +164,23 @@ NU1903 - + + + + + + + + + + + + + + + + + diff --git a/RevitAddin.CommandLoader/Services/CodeDom/CodeAnalysisCodeDomService.cs b/RevitAddin.CommandLoader/Services/CodeDom/CodeAnalysisCodeDomService.cs new file mode 100644 index 0000000..75371ec --- /dev/null +++ b/RevitAddin.CommandLoader/Services/CodeDom/CodeAnalysisCodeDomService.cs @@ -0,0 +1,82 @@ +#if NET8_0_OR_GREATER + +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.Text; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; + +namespace RevitAddin.CommandLoader.Services.CodeDom +{ + public class CodeAnalysisCodeDomService : ICodeDomService + { + private string[] PreprocessorSymbols { get; set; } + public ICodeDomService SetDefines(params string[] defines) + { + PreprocessorSymbols = defines; + return this; + } + + public Assembly GenerateCode(params string[] sourceCode) + { + return GenerateCode(sourceCode.FirstOrDefault()); + } + + public Assembly GenerateCode(string sourceCode) + { + var compilation = CompilationCode(sourceCode, PreprocessorSymbols); + + var filePath = Path.Combine(Path.GetTempPath(), compilation.Assembly.Name + ".dll"); + using (var file = File.Create(filePath)) + { + var result = compilation.Emit(file); + } + + return Assembly.LoadFrom(filePath); + } + + private CSharpCompilation CompilationCode(string sourceCode, string[] preprocessorSymbols = null) + { + var codeString = SourceText.From(sourceCode); + var options = CSharpParseOptions.Default + .WithLanguageVersion(LanguageVersion.Latest) + .WithPreprocessorSymbols(preprocessorSymbols); + + var parsedSyntaxTree = SyntaxFactory.ParseSyntaxTree(codeString, options); + + var references = new List + { + MetadataReference.CreateFromFile(typeof(object).Assembly.Location), + MetadataReference.CreateFromFile(typeof(Console).Assembly.Location) + }; + + #region Add GetReferencedAssemblies + var assemblyNames = Assembly.GetExecutingAssembly().GetReferencedAssemblies(); + var nameAssemblies = new Dictionary(); + foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) + { + if (assemblyNames.Any(e => e.Name == assembly.GetName().Name)) + { + nameAssemblies[assembly.GetName().Name] = assembly; + } + } + foreach (var keyAssembly in nameAssemblies) + { + references.Add(MetadataReference.CreateFromFile(keyAssembly.Value.Location)); + } + #endregion + + return CSharpCompilation.Create(Guid.NewGuid().ToString(), + new[] { parsedSyntaxTree }, + references: references, + options: new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary, + optimizationLevel: OptimizationLevel.Release, + assemblyIdentityComparer: DesktopAssemblyIdentityComparer.Default)); + } + } +} + +#endif \ No newline at end of file diff --git a/RevitAddin.CommandLoader/Services/CodeDomFactory.cs b/RevitAddin.CommandLoader/Services/CodeDomFactory.cs index 484d765..88bf238 100644 --- a/RevitAddin.CommandLoader/Services/CodeDomFactory.cs +++ b/RevitAddin.CommandLoader/Services/CodeDomFactory.cs @@ -8,9 +8,12 @@ public class CodeDomFactory private static ICodeDomService CreateCodeDomService() { +#if NET8_0_OR_GREATER + return new CodeAnalysisCodeDomService(); +#else var provider = CodeProviderService.GetCSharpCodeProvider(); - return new CodeDomService(provider); +#endif } } diff --git a/RevitAddin.CommandLoader/Services/GistGithubUtils.cs b/RevitAddin.CommandLoader/Services/GistGithubUtils.cs index d2194a2..51f6f13 100644 --- a/RevitAddin.CommandLoader/Services/GistGithubUtils.cs +++ b/RevitAddin.CommandLoader/Services/GistGithubUtils.cs @@ -1,10 +1,6 @@ -using Autodesk.Revit.Exceptions; -using System; +using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Media.Animation; namespace RevitAddin.CommandLoader.Services { From dab949b7c7e8e23ee9a9e8c4609014c7c4995576 Mon Sep 17 00:00:00 2001 From: Luiz Henrique Cassettari Date: Sat, 17 Feb 2024 10:57:26 -0300 Subject: [PATCH 3/6] Add `Newtonsoft.Json` to support `GistGithubUtils` download string. --- CHANGELOG.md | 3 ++ .../GistGithubUtilsTests.cs | 41 +++++++++++++++++++ .../RevitAddin.CommandLoader.Tests.csproj | 6 +++ .../Services/GistGithubUtils.cs | 23 ++++++++++- 4 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 RevitAddin.CommandLoader.Tests/GistGithubUtilsTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 914ca3e..39006aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Support net core plugin. ### Added - Add `CodeAnalysisCodeDom` to support net code. +### Tests +- Test `GistGithubUtils` download string. +- Add `Newtonsoft.Json` to support `GistGithubUtils` download string. ## [1.0.6] / 2024-01-27 ### Features diff --git a/RevitAddin.CommandLoader.Tests/GistGithubUtilsTests.cs b/RevitAddin.CommandLoader.Tests/GistGithubUtilsTests.cs new file mode 100644 index 0000000..9517feb --- /dev/null +++ b/RevitAddin.CommandLoader.Tests/GistGithubUtilsTests.cs @@ -0,0 +1,41 @@ +using NUnit.Framework; +using RevitAddin.CommandLoader.Services; +using System; + +namespace RevitAddin.CommandLoader.Tests +{ + public class GistGithubUtilsTests + { + private const string GIST_SOURCE = "https://gist.github.com/ricaun/200a576c3baa45cba034ceedac1e708e"; + + [Test] + public void Test_TryGetGistFilesContent() + { + var hasGistContent = GistGithubUtils.TryGetGistFilesContent(GIST_SOURCE, out string[] contents); + Assert.IsTrue(hasGistContent, "Gist content not found."); + } + + [Test] + public void Test_TryGetGistModel() + { + var hasGistContent = GistGithubUtils.TryGetGistModel(GIST_SOURCE, out var model); + Assert.IsTrue(hasGistContent, "Gist content not found."); + } + + [Test] + public void Test_TryGetGistId() + { + var hasGistContent = GistGithubUtils.TryGetGistId(GIST_SOURCE, out var id); + Assert.IsTrue(hasGistContent, "Gist content not found."); + Console.WriteLine(id); + } + + [Test] + public void Test_TryGetGistString() + { + var hasGistContent = GistGithubUtils.TryGetGistString(GIST_SOURCE, out string content); + Assert.IsTrue(hasGistContent, "Gist content not found."); + } + + } +} \ No newline at end of file diff --git a/RevitAddin.CommandLoader.Tests/RevitAddin.CommandLoader.Tests.csproj b/RevitAddin.CommandLoader.Tests/RevitAddin.CommandLoader.Tests.csproj index 4d9ffd5..8965ff4 100644 --- a/RevitAddin.CommandLoader.Tests/RevitAddin.CommandLoader.Tests.csproj +++ b/RevitAddin.CommandLoader.Tests/RevitAddin.CommandLoader.Tests.csproj @@ -90,4 +90,10 @@ + + + NU1903 + + + diff --git a/RevitAddin.CommandLoader/Services/GistGithubUtils.cs b/RevitAddin.CommandLoader/Services/GistGithubUtils.cs index 51f6f13..38bd066 100644 --- a/RevitAddin.CommandLoader/Services/GistGithubUtils.cs +++ b/RevitAddin.CommandLoader/Services/GistGithubUtils.cs @@ -6,6 +6,12 @@ namespace RevitAddin.CommandLoader.Services { public class GistGithubUtils { + /// + /// Try to download the content of a gist from a given url. + /// + /// + /// + /// public static bool TryGetGistString(string url, out string output) { output = ""; @@ -22,6 +28,12 @@ public static bool TryGetGistString(string url, out string output) return false; } + /// + /// Try to get Gist Id. + /// + /// + /// + /// public static bool TryGetGistId(string url, out string id) { id = ""; @@ -34,6 +46,12 @@ public static bool TryGetGistId(string url, out string id) return false; } + /// + /// Try to get the content of a gist from a given url. + /// + /// + /// + /// public static bool TryGetGistFilesContent(string url, out string[] contents) { contents = null; @@ -62,7 +80,10 @@ public static bool TryGetGistModel(string url, out GistModel gistModel) var jsonService = new JsonService(); gistModel = jsonService.Deserialize(content); } - catch { } + catch (System.Exception ex) + { + Console.WriteLine(ex); + } return gistModel is not null; } From bb12d2df97971f595c534c62643f61f9e5fcbfc4 Mon Sep 17 00:00:00 2001 From: Luiz Henrique Cassettari Date: Sat, 17 Feb 2024 11:13:44 -0300 Subject: [PATCH 4/6] Update `CodeAnalysisCodeDomService` to work with multiple source code. --- CHANGELOG.md | 1 + .../CodeDom/CodeTester.cs | 27 ++++++++++++++++--- .../CodeDomTests.cs | 3 +++ .../CodeDom/CodeAnalysisCodeDomService.cs | 14 ++++------ 4 files changed, 33 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 39006aa..d2275ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Support net core plugin. ### Added - Add `CodeAnalysisCodeDom` to support net code. +- Update `CodeAnalysisCodeDomService` to work with multiple source code. ### Tests - Test `GistGithubUtils` download string. - Add `Newtonsoft.Json` to support `GistGithubUtils` download string. diff --git a/RevitAddin.CommandLoader.Tests/CodeDom/CodeTester.cs b/RevitAddin.CommandLoader.Tests/CodeDom/CodeTester.cs index 4a3c816..5757f05 100644 --- a/RevitAddin.CommandLoader.Tests/CodeDom/CodeTester.cs +++ b/RevitAddin.CommandLoader.Tests/CodeDom/CodeTester.cs @@ -5,6 +5,7 @@ namespace RevitAddin.CommandLoader.Tests.CodeDom public class CodeTester { const string code = """ +using System; public class Tests { public void Test() { } @@ -13,16 +14,36 @@ public void Debug() { } #endif } """; - public string Code => code; + const string code2 = """ +using System; +public class Tests2 +{ + public void Test() { } +#if DEBUG + public void Debug() { } +#endif +} +"""; + public string[] Code => new[] { code, code2 }; public string[] Defines => new[] { "DEBUG" }; public bool HasMethodTest(Assembly assembly) { - var method = assembly.GetType("Tests").GetMethod("Test"); + var method = assembly.GetType("Tests")?.GetMethod("Test"); return method is not null; } public bool HasMethodDebug(Assembly assembly) { - var method = assembly.GetType("Tests").GetMethod("Debug"); + var method = assembly.GetType("Tests")?.GetMethod("Debug"); + return method is not null; + } + public bool HasMethodTest2(Assembly assembly) + { + var method = assembly.GetType("Tests2")?.GetMethod("Test"); + return method is not null; + } + public bool HasMethodDebug2(Assembly assembly) + { + var method = assembly.GetType("Tests2")?.GetMethod("Debug"); return method is not null; } } diff --git a/RevitAddin.CommandLoader.Tests/CodeDomTests.cs b/RevitAddin.CommandLoader.Tests/CodeDomTests.cs index 46daeed..82219f4 100644 --- a/RevitAddin.CommandLoader.Tests/CodeDomTests.cs +++ b/RevitAddin.CommandLoader.Tests/CodeDomTests.cs @@ -20,6 +20,9 @@ public void Test_ICodeDomService(ICodeDomService codeDomService) Assert.IsTrue(CodeTester.HasMethodTest(assembly), "Test method not found."); Assert.IsTrue(CodeTester.HasMethodDebug(assembly), "Debug method not found."); + + Assert.IsTrue(CodeTester.HasMethodTest2(assembly), "Test method not found in the Tests2 class."); + Assert.IsTrue(CodeTester.HasMethodDebug2(assembly), "Debug method not found in the Tests2 class."); } [Test] diff --git a/RevitAddin.CommandLoader/Services/CodeDom/CodeAnalysisCodeDomService.cs b/RevitAddin.CommandLoader/Services/CodeDom/CodeAnalysisCodeDomService.cs index 75371ec..3c6f770 100644 --- a/RevitAddin.CommandLoader/Services/CodeDom/CodeAnalysisCodeDomService.cs +++ b/RevitAddin.CommandLoader/Services/CodeDom/CodeAnalysisCodeDomService.cs @@ -21,11 +21,6 @@ public ICodeDomService SetDefines(params string[] defines) } public Assembly GenerateCode(params string[] sourceCode) - { - return GenerateCode(sourceCode.FirstOrDefault()); - } - - public Assembly GenerateCode(string sourceCode) { var compilation = CompilationCode(sourceCode, PreprocessorSymbols); @@ -38,14 +33,15 @@ public Assembly GenerateCode(string sourceCode) return Assembly.LoadFrom(filePath); } - private CSharpCompilation CompilationCode(string sourceCode, string[] preprocessorSymbols = null) + private CSharpCompilation CompilationCode(string[] sourceCodes, string[] preprocessorSymbols = null) { - var codeString = SourceText.From(sourceCode); var options = CSharpParseOptions.Default .WithLanguageVersion(LanguageVersion.Latest) .WithPreprocessorSymbols(preprocessorSymbols); - var parsedSyntaxTree = SyntaxFactory.ParseSyntaxTree(codeString, options); + var parsedSyntaxTrees = sourceCodes + .Select(sourceCode => SyntaxFactory.ParseSyntaxTree(sourceCode, options)) + .ToArray(); var references = new List { @@ -70,7 +66,7 @@ private CSharpCompilation CompilationCode(string sourceCode, string[] preprocess #endregion return CSharpCompilation.Create(Guid.NewGuid().ToString(), - new[] { parsedSyntaxTree }, + parsedSyntaxTrees, references: references, options: new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary, optimizationLevel: OptimizationLevel.Release, From 497bb65cad754bfbb11ffe16047290549bf63ee4 Mon Sep 17 00:00:00 2001 From: Luiz Henrique Cassettari Date: Sat, 17 Feb 2024 11:23:46 -0300 Subject: [PATCH 5/6] Prerelease alpha version --- Build/Build.cs | 2 +- RevitAddin.CommandLoader/RevitAddin.CommandLoader.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Build/Build.cs b/Build/Build.cs index 8e615fe..73d2ebd 100644 --- a/Build/Build.cs +++ b/Build/Build.cs @@ -3,7 +3,7 @@ using ricaun.Nuke; using ricaun.Nuke.Components; -class Build : NukeBuild, IPublishRevit, ITest +class Build : NukeBuild, IPublishRevit, ITest, IGitPreRelease { string IHazRevitPackageBuilder.Application => "Revit.App"; public static int Main() => Execute(x => x.From().Build); diff --git a/RevitAddin.CommandLoader/RevitAddin.CommandLoader.csproj b/RevitAddin.CommandLoader/RevitAddin.CommandLoader.csproj index 9d94817..e8bdd9b 100644 --- a/RevitAddin.CommandLoader/RevitAddin.CommandLoader.csproj +++ b/RevitAddin.CommandLoader/RevitAddin.CommandLoader.csproj @@ -108,7 +108,7 @@ RevitAddin.CommandLoader - 1.1.0 + 1.1.0-alpha {82070359-36DA-4441-A59D-9018B6A8B348} From d86b5440b78685046440761d18b8df1629221c42 Mon Sep 17 00:00:00 2001 From: Luiz Henrique Cassettari Date: Sat, 17 Feb 2024 11:57:42 -0300 Subject: [PATCH 6/6] Release Version --- RevitAddin.CommandLoader/RevitAddin.CommandLoader.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RevitAddin.CommandLoader/RevitAddin.CommandLoader.csproj b/RevitAddin.CommandLoader/RevitAddin.CommandLoader.csproj index e8bdd9b..9d94817 100644 --- a/RevitAddin.CommandLoader/RevitAddin.CommandLoader.csproj +++ b/RevitAddin.CommandLoader/RevitAddin.CommandLoader.csproj @@ -108,7 +108,7 @@ RevitAddin.CommandLoader - 1.1.0-alpha + 1.1.0 {82070359-36DA-4441-A59D-9018B6A8B348}