diff --git a/.editorconfig b/.editorconfig index fd8f5cd0..b2ce22c1 100644 --- a/.editorconfig +++ b/.editorconfig @@ -78,6 +78,10 @@ csharp_style_throw_expression = true:suggestion csharp_style_conditional_delegate_call = true:suggestion dotnet_style_require_accessibility_modifiers = omit_if_default:warning + +# ArgumentNullException.ThrowIfNull not present in some TFMs +dotnet_diagnostic.CA1510.severity = none + # hack: suppress analyzers on the imported file Options.cs [Options.cs] generated_code = true \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5b3e0e24..76c8cf97 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,10 +24,8 @@ jobs: uses: actions/setup-dotnet@v2 with: dotnet-version: | - 2.1.x - 3.1.x - 5.0.x 6.0.x + 7.0.x - name: Find MSBuild if: startsWith(matrix.os, 'windows') diff --git a/Directory.Build.props b/Directory.Build.props index 8d7b5ee8..f7580d16 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -16,7 +16,7 @@ - + @@ -29,7 +29,7 @@ true - + diff --git a/Mono.TextTemplating.Build.Tests/MSBuildExecutionTests.cs b/Mono.TextTemplating.Build.Tests/MSBuildExecutionTests.cs index 33ac9ef9..1b16527c 100644 --- a/Mono.TextTemplating.Build.Tests/MSBuildExecutionTests.cs +++ b/Mono.TextTemplating.Build.Tests/MSBuildExecutionTests.cs @@ -9,6 +9,8 @@ namespace Mono.TextTemplating.Tests { + // MSBuild relies on changing the current working directory to the project directory so we need to run tests serially + [CollectionDefinition (nameof (MSBuildExecutionTests), DisableParallelization = true)] public class MSBuildExecutionTests : IClassFixture { [Fact] diff --git a/Mono.TextTemplating.Build.Tests/MSBuildTestContext.cs b/Mono.TextTemplating.Build.Tests/MSBuildTestContext.cs index e7721438..a804144e 100644 --- a/Mono.TextTemplating.Build.Tests/MSBuildTestContext.cs +++ b/Mono.TextTemplating.Build.Tests/MSBuildTestContext.cs @@ -45,7 +45,7 @@ public MSBuildTestContext ([CallerMemberName] string testName = null, bool creat public ProjectCollection Engine { get; } - static ILogger CreateBinLogger (string testName) => new BinaryLogger { Parameters = $"LogFile=binlogs/{testName}.binlog" }; + static BinaryLogger CreateBinLogger (string testName) => new BinaryLogger { Parameters = $"LogFile=binlogs/{testName}.binlog" }; public void Dispose () { @@ -71,7 +71,7 @@ public MSBuildTestProject LoadTestProject (string projectName = null, [CallerMem } } - class MSBuildTestProject + sealed class MSBuildTestProject { public MSBuildTestProject (MSBuildTestContext context, Project project) { @@ -125,7 +125,7 @@ public MSBuildTestProject WithProperty (string name, string value) } } - class MSBuildTestErrorLogger : ILogger + sealed class MSBuildTestErrorLogger : ILogger { public List ErrorsAndWarnings { get; } = new List (); @@ -188,7 +188,7 @@ public static void AssertPaths (this ICollection items, par var actualPaths = items.Select (item => item.GetMetadataValue ("FullPath")).ToHashSet (); foreach (var expectedPath in expectedFullPaths) { if (!actualPaths.Remove (expectedPath)) { - throw new Xunit.Sdk.ContainsException (expectedPath, actualPaths); + throw Xunit.Sdk.ContainsException.ForSetItemNotFound ("\"" + expectedPath + "\"", "\"" + string.Join ("\", \"", actualPaths) + "\""); } } Assert.Empty (actualPaths); @@ -232,7 +232,7 @@ public static TestDataPath GetIntermediateDirFile (this ProjectInstance instance => GetIntermediateDir (instance).Combine (paths); } - class MSBuildFixture + sealed class MSBuildFixture { public MSBuildFixture () => MSBuildTestHelpers.RegisterMSBuildAssemblies (); } diff --git a/Mono.TextTemplating.Build.Tests/MSBuildTestHelpers.cs b/Mono.TextTemplating.Build.Tests/MSBuildTestHelpers.cs index e405fd1a..ffb76b8f 100644 --- a/Mono.TextTemplating.Build.Tests/MSBuildTestHelpers.cs +++ b/Mono.TextTemplating.Build.Tests/MSBuildTestHelpers.cs @@ -41,7 +41,9 @@ public static void RegisterMSBuildAssemblies () //attempt to read the msbuild.dll location from the launch script //FIXME: handle quoting in the script Console.WriteLine ("Found msbuild script in PATH: {0}", msbuildInPath); +#pragma warning disable CA1861 // Avoid constant arrays as arguments var tokens = File.ReadAllText (msbuildInPath).Split (new [] { ' ', '\t', '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); +#pragma warning restore CA1861 // Avoid constant arrays as arguments var filename = tokens.FirstOrDefault (t => t.EndsWith ("MSBuild.dll", StringComparison.OrdinalIgnoreCase)); if (filename != null && File.Exists (filename)) { var dir = Path.GetDirectoryName (filename); diff --git a/Mono.TextTemplating.Build.Tests/Mono.TextTemplating.Build.Tests.csproj b/Mono.TextTemplating.Build.Tests/Mono.TextTemplating.Build.Tests.csproj index 940fe931..89ac0d18 100644 --- a/Mono.TextTemplating.Build.Tests/Mono.TextTemplating.Build.Tests.csproj +++ b/Mono.TextTemplating.Build.Tests/Mono.TextTemplating.Build.Tests.csproj @@ -1,6 +1,7 @@ - net472;net6.0 + net6.0;net7.0 + net48;$(TargetFrameworks) false $(DefaultItemExcludes);TestCases\** @@ -10,32 +11,27 @@ - - - - - + + + + + - - + + - - - - - - + + + - - diff --git a/Mono.TextTemplating.Build/MSBuildTemplateGenerator.cs b/Mono.TextTemplating.Build/MSBuildTemplateGenerator.cs index d2690bdd..345f3293 100644 --- a/Mono.TextTemplating.Build/MSBuildTemplateGenerator.cs +++ b/Mono.TextTemplating.Build/MSBuildTemplateGenerator.cs @@ -8,7 +8,7 @@ namespace Mono.TextTemplating.Build { - class MSBuildTemplateGenerator : TemplateGenerator + sealed class MSBuildTemplateGenerator : TemplateGenerator { public MSBuildTemplateGenerator () { diff --git a/Mono.TextTemplating.Build/MSBuildTemplateSession.cs b/Mono.TextTemplating.Build/MSBuildTemplateSession.cs index a75af215..91c6ec84 100644 --- a/Mono.TextTemplating.Build/MSBuildTemplateSession.cs +++ b/Mono.TextTemplating.Build/MSBuildTemplateSession.cs @@ -10,7 +10,7 @@ namespace Mono.TextTemplating.Build { - class MSBuildTemplateSession : ITextTemplatingSession + sealed class MSBuildTemplateSession : ITextTemplatingSession { readonly Dictionary session = new Dictionary (); readonly MSBuildTemplateGenerator toolTemplateGenerator; diff --git a/Mono.TextTemplating.Build/Mono.TextTemplating.Build.csproj b/Mono.TextTemplating.Build/Mono.TextTemplating.Build.csproj index c752bec5..7a7344ce 100644 --- a/Mono.TextTemplating.Build/Mono.TextTemplating.Build.csproj +++ b/Mono.TextTemplating.Build/Mono.TextTemplating.Build.csproj @@ -1,7 +1,7 @@ - netcoreapp2.1;net472 + net48;net6.0 T4.BuildTools MSBuild build targets for the T4 templating language, a general-purpose way to generate text or code files using C# true @@ -10,6 +10,7 @@ end up loading Mono.TextTemplating.dll for the wrong runtime --> buildTasks true + en-US @@ -29,11 +30,12 @@ - - - - + + + + + diff --git a/Mono.TextTemplating.Build/TemplateBuildState.cs b/Mono.TextTemplating.Build/TemplateBuildState.cs index bda25795..c042afd8 100644 --- a/Mono.TextTemplating.Build/TemplateBuildState.cs +++ b/Mono.TextTemplating.Build/TemplateBuildState.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using MessagePack; @@ -16,10 +17,10 @@ namespace Mono.TextTemplating.Build [MessagePackObject] public class TemplateBuildState { - public const int CURRENT_FORMAT_VERSION = 0; + public const int CurrentFormatVersion = 0; [Key (0)] - public int FormatVersion { get; set; } = CURRENT_FORMAT_VERSION; + public int FormatVersion { get; set; } = CurrentFormatVersion; [Key (1)] public string DefaultNamespace { get; set; } [Key (2)] @@ -185,6 +186,8 @@ public bool Equals (DirectiveProcessor other) => Name == other?.Name && Class == other.Name && Assembly == other?.Assembly; public override bool Equals (object obj) => Equals (obj as DirectiveProcessor); + + public override int GetHashCode () => HashCode.Combine (Name, Class, Assembly); } [MessagePackObject] @@ -203,6 +206,8 @@ public bool Equals (Parameter other) => Processor == other?.Processor && Directive == other.Directive && Name == other?.Name && Value == other?.Value; public override bool Equals (object obj) => Equals (obj as Parameter); + + public override int GetHashCode () => HashCode.Combine (Processor, Directive, Name, Value); } // TODO: cache warnings @@ -280,5 +285,13 @@ public bool IsStale (Func getFileWriteTime, TaskLoggingHelper return false; } } + +#if !NETCOREAPP2_1_OR_GREATER + struct HashCode + { + public static int Combine (T1 value1, T2 value2, T3 value3) => (value1?.GetHashCode () ?? 0) ^ (value2?.GetHashCode () ?? 0) ^ (value3?.GetHashCode () ?? 0); + public static int Combine (T1 value1, T2 value2, T3 value3, T4 value4) => Combine (value1, value2, value3) ^ (value4?.GetHashCode () ?? 0); + } +#endif } } diff --git a/Mono.TextTemplating.Build/TextTransform.cs b/Mono.TextTemplating.Build/TextTransform.cs index 7978d802..d004d13e 100644 --- a/Mono.TextTemplating.Build/TextTransform.cs +++ b/Mono.TextTemplating.Build/TextTransform.cs @@ -260,7 +260,7 @@ TemplateBuildState LoadBuildState (string filePath, MessagePackSerializerOptions var state = MessagePackSerializer.Deserialize (stream, options); - if (state.FormatVersion != TemplateBuildState.CURRENT_FORMAT_VERSION) { + if (state.FormatVersion != TemplateBuildState.CurrentFormatVersion) { Log.LogMessageFromResources (MessageImportance.Low, nameof(Messages.BuildStateFormatChanged)); } diff --git a/Mono.TextTemplating.Build/TextTransformProcessor.cs b/Mono.TextTemplating.Build/TextTransformProcessor.cs index a2f1f49d..065a76bd 100644 --- a/Mono.TextTemplating.Build/TextTransformProcessor.cs +++ b/Mono.TextTemplating.Build/TextTransformProcessor.cs @@ -209,7 +209,7 @@ static MSBuildTemplateGenerator CreateGenerator (TemplateBuildState buildState) return generator; } - class WriteTimeCache + sealed class WriteTimeCache { public DateTime? GetWriteTime (string filepath) { diff --git a/Mono.TextTemplating.Roslyn/Mono.TextTemplating.Roslyn.csproj b/Mono.TextTemplating.Roslyn/Mono.TextTemplating.Roslyn.csproj index c98ebc44..b0808a88 100644 --- a/Mono.TextTemplating.Roslyn/Mono.TextTemplating.Roslyn.csproj +++ b/Mono.TextTemplating.Roslyn/Mono.TextTemplating.Roslyn.csproj @@ -1,7 +1,7 @@ - netcoreapp2.1;net472 + netstandard2.0;net472;net6.0 Mono.TextTemplating.Roslyn Mono.TextTemplating In-process Roslyn compiler for the Mono.TextTemplating T4 templating engine @@ -11,8 +11,8 @@ - - + + diff --git a/Mono.TextTemplating.Roslyn/RoslynCodeCompiler.cs b/Mono.TextTemplating.Roslyn/RoslynCodeCompiler.cs index f0e32e6c..6e875b71 100644 --- a/Mono.TextTemplating.Roslyn/RoslynCodeCompiler.cs +++ b/Mono.TextTemplating.Roslyn/RoslynCodeCompiler.cs @@ -17,7 +17,7 @@ namespace Mono.TextTemplating { - class RoslynCodeCompiler : CodeCompiler + sealed class RoslynCodeCompiler : CodeCompiler { readonly RuntimeInfo runtime; diff --git a/Mono.TextTemplating.Roslyn/RoslynCodeCompilerException.cs b/Mono.TextTemplating.Roslyn/RoslynCodeCompilerException.cs index 143a0ca0..e06c2d1a 100644 --- a/Mono.TextTemplating.Roslyn/RoslynCodeCompilerException.cs +++ b/Mono.TextTemplating.Roslyn/RoslynCodeCompilerException.cs @@ -1,16 +1,14 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; -using System.Runtime.Serialization; namespace Mono.TextTemplating { [Serializable] - class RoslynCodeCompilerException : Exception + sealed class RoslynCodeCompilerException : Exception { public RoslynCodeCompilerException () { } public RoslynCodeCompilerException (string message) : base (message) { } public RoslynCodeCompilerException (string message, Exception inner) : base (message, inner) { } - protected RoslynCodeCompilerException (SerializationInfo info, StreamingContext context) : base (info, context) { } } } \ No newline at end of file diff --git a/Mono.TextTemplating.Tests/AppDomainTests.cs b/Mono.TextTemplating.Tests/AppDomainTests.cs index b0898e34..f8ee59c4 100644 --- a/Mono.TextTemplating.Tests/AppDomainTests.cs +++ b/Mono.TextTemplating.Tests/AppDomainTests.cs @@ -107,7 +107,7 @@ static TestTemplateGeneratorWithAppDomain CreateGeneratorWithAppDomain ( static string GetAppDomainNameForCurrentTest ([CallerMemberName] string testName = null) => $"Template Test - {testName ?? "(unknown)"}"; - class TestTemplateGeneratorWithAppDomain : TemplateGenerator + sealed class TestTemplateGeneratorWithAppDomain : TemplateGenerator { AppDomain appDomain; public TestTemplateGeneratorWithAppDomain (AppDomain appDomain) => this.appDomain = appDomain; diff --git a/Mono.TextTemplating.Tests/GenerateIndentedClassCodeTests.cs b/Mono.TextTemplating.Tests/GenerateIndentedClassCodeTests.cs index cadc0ce9..13006168 100644 --- a/Mono.TextTemplating.Tests/GenerateIndentedClassCodeTests.cs +++ b/Mono.TextTemplating.Tests/GenerateIndentedClassCodeTests.cs @@ -49,13 +49,13 @@ public void FieldAndPropertyGenerated () Assert.Equal (expectedOutput, output); } - static CodeTypeMember CreateBoolField () + static CodeMemberField CreateBoolField () { var type = new CodeTypeReference (typeof(bool)); return new CodeMemberField { Name = "myField", Type = type }; } - static CodeTypeMember CreateBoolProperty () + static CodeMemberProperty CreateBoolProperty () { var type = new CodeTypeReference (typeof(bool)); var prop = new CodeMemberProperty { Name = "MyProperty", Type = type }; diff --git a/Mono.TextTemplating.Tests/GenerationTests.cs b/Mono.TextTemplating.Tests/GenerationTests.cs index 6ada5414..ab06d9a1 100644 --- a/Mono.TextTemplating.Tests/GenerationTests.cs +++ b/Mono.TextTemplating.Tests/GenerationTests.cs @@ -89,7 +89,7 @@ static void GenerateOutput (string input, string expectedOutput, string newline) #region Helpers - static string GenerateCode (ITextTemplatingEngineHost host, string content, string name, string generatorNewline) + static string GenerateCode (DummyHost host, string content, string name, string generatorNewline) { var pt = ParsedTemplate.FromTextInternal (content, host); if (pt.Errors.HasErrors) { diff --git a/Mono.TextTemplating.Tests/Mono.TextTemplating.Tests.csproj b/Mono.TextTemplating.Tests/Mono.TextTemplating.Tests.csproj index 4848acfc..00bdac8b 100644 --- a/Mono.TextTemplating.Tests/Mono.TextTemplating.Tests.csproj +++ b/Mono.TextTemplating.Tests/Mono.TextTemplating.Tests.csproj @@ -1,35 +1,25 @@ - net472;netcoreapp2.1;netcoreapp3.1;net5.0 + net6.0;net7.0 + net472;$(TargetFrameworks) false $(DefineConstants);FEATURE_APPDOMAINS $(DefaultItemExcludes);TestCases\** - - - - - - - - + + + - - @@ -49,13 +39,9 @@ <_PackageDownloadWithVersion Include="@(PackageDownload)" Version="$([System.String]::Copy('%(Version)').Replace('[','').Replace(']',''))" /> <_PackageDownloadWithPath Include="@(_PackageDownloadWithVersion)" Path="$(_NuGetPackageRootWithTrailingSlash)$([System.String]::Copy('%(Identity)').ToLower())\%(Version)" /> - <_PackageDownloadVars - Include="@(_PackageDownloadWithPath)" - VarName="$([System.String]::Copy('%(Identity)_%(Version)').Replace('.','_'))" - EscapedValue="$([System.String]::Copy('%(Path)').Replace('\','\\'))" - /> + <_PackageDownloadVars Include="@(_PackageDownloadWithPath)" VarName="$([System.String]::Copy('%(Identity)_%(Version)').Replace('.','_'))" EscapedValue="$([System.String]::Copy('%(Path)').Replace('\','\\'))" /> <_PackageDownloadPathConstLines Include="namespace $(ProjectName) {" /> - <_PackageDownloadPathConstLines Include="partial class PackagePath {" /> + <_PackageDownloadPathConstLines Include="sealed class PackagePath {" /> <_PackageDownloadPathConstLines Include="@(_PackageDownloadVars->' public static TestDataPath %(VarName) => new("%(EscapedValue)");')" /> <_PackageDownloadPathConstLines Include="}}" /> diff --git a/Mono.TextTemplating.Tests/ProcessingTests.cs b/Mono.TextTemplating.Tests/ProcessingTests.cs index 344190c7..58b5a4f1 100644 --- a/Mono.TextTemplating.Tests/ProcessingTests.cs +++ b/Mono.TextTemplating.Tests/ProcessingTests.cs @@ -57,10 +57,13 @@ public async Task CSharp9Records () await gen.ProcessTemplateAsync (null, template, outputName); CompilerError firstError = gen.Errors.OfType ().FirstOrDefault (); -#if NET5_0 - Assert.Null (firstError); -#else + + // note: when running on netsdk we use the highest available csc regardless of runtime version, + // so records will always be available on our test environments +#if NETFRAMEWORK Assert.NotNull (firstError); +#else + Assert.Null (firstError); #endif } diff --git a/Mono.TextTemplating.Tests/TestDataPath.cs b/Mono.TextTemplating.Tests/TestDataPath.cs index 2622d76f..cb0e9d8e 100644 --- a/Mono.TextTemplating.Tests/TestDataPath.cs +++ b/Mono.TextTemplating.Tests/TestDataPath.cs @@ -147,7 +147,7 @@ public DateTime AssertWriteTimeNewerThan (DateTime previousWriteTime) } } -class WriteTimeTracker +sealed class WriteTimeTracker { readonly TestDataPath file; DateTime lastWriteTime; diff --git a/Mono.TextTemplating.Tests/xunit.runner.json b/Mono.TextTemplating.Tests/xunit.runner.json deleted file mode 100644 index 1adceda1..00000000 --- a/Mono.TextTemplating.Tests/xunit.runner.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "parallelizeAssembly": false, - "parallelizeTestCollections": false -} \ No newline at end of file diff --git a/Mono.TextTemplating.sln b/Mono.TextTemplating.sln index 692561b4..8301d53f 100644 --- a/Mono.TextTemplating.sln +++ b/Mono.TextTemplating.sln @@ -1,6 +1,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30914.41 +# Visual Studio Version 17 +VisualStudioVersion = 17.8.34004.107 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Mono.TextTemplating", "Mono.TextTemplating\Mono.TextTemplating.csproj", "{A2364D6A-00EF-417C-80A6-815726C70032}" EndProject @@ -17,8 +17,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dotnet-t4", "dotnet-t4\dotnet-t4.csproj", "{6AA924D8-7119-4593-9B56-11D17AC3578E}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dotnet-t4-project-tool", "dotnet-t4-project-tool\dotnet-t4-project-tool.csproj", "{114B7AEF-61DA-453A-9A84-6DDEA13460B7}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Mono.TextTemplating.Build", "Mono.TextTemplating.Build\Mono.TextTemplating.Build.csproj", "{12F53C72-56EC-4740-B6B2-FF31A1B3D3B8}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Mono.TextTemplating.Build.Tests", "Mono.TextTemplating.Build.Tests\Mono.TextTemplating.Build.Tests.csproj", "{6BF2F02D-127E-4EF9-9F39-A7E3667A6958}" @@ -47,10 +45,6 @@ Global {6AA924D8-7119-4593-9B56-11D17AC3578E}.Debug|Any CPU.Build.0 = Debug|Any CPU {6AA924D8-7119-4593-9B56-11D17AC3578E}.Release|Any CPU.ActiveCfg = Release|Any CPU {6AA924D8-7119-4593-9B56-11D17AC3578E}.Release|Any CPU.Build.0 = Release|Any CPU - {114B7AEF-61DA-453A-9A84-6DDEA13460B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {114B7AEF-61DA-453A-9A84-6DDEA13460B7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {114B7AEF-61DA-453A-9A84-6DDEA13460B7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {114B7AEF-61DA-453A-9A84-6DDEA13460B7}.Release|Any CPU.Build.0 = Release|Any CPU {12F53C72-56EC-4740-B6B2-FF31A1B3D3B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {12F53C72-56EC-4740-B6B2-FF31A1B3D3B8}.Debug|Any CPU.Build.0 = Debug|Any CPU {12F53C72-56EC-4740-B6B2-FF31A1B3D3B8}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/Mono.TextTemplating/CompatibilitySuppressions.xml b/Mono.TextTemplating/CompatibilitySuppressions.xml index 48160e90..3ec120d8 100644 --- a/Mono.TextTemplating/CompatibilitySuppressions.xml +++ b/Mono.TextTemplating/CompatibilitySuppressions.xml @@ -1,11 +1,26 @@ + - CP0006 M:Microsoft.VisualStudio.TextTemplating.ITextTemplatingEngineHost.ProvideTemplatingAppDomain(System.String) lib/netstandard2.0/Mono.TextTemplating.dll lib/netstandard2.0/Mono.TextTemplating.dll true + + + CP0019 + M:Microsoft.VisualStudio.TextTemplating.DirectiveProcessorException.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext) + lib/net472/Mono.TextTemplating.dll + lib/net472/Mono.TextTemplating.dll + true + + + CP0019 + M:Microsoft.VisualStudio.TextTemplating.DirectiveProcessorException.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext) + lib/netstandard2.0/Mono.TextTemplating.dll + lib/netstandard2.0/Mono.TextTemplating.dll + true + \ No newline at end of file diff --git a/Mono.TextTemplating/Mono.TextTemplating.csproj b/Mono.TextTemplating/Mono.TextTemplating.csproj index f6526d84..a47b47a0 100644 --- a/Mono.TextTemplating/Mono.TextTemplating.csproj +++ b/Mono.TextTemplating/Mono.TextTemplating.csproj @@ -1,6 +1,6 @@ - netstandard2.0;netcoreapp2.1;netcoreapp3.1;net472 + netstandard2.0;net6.0;net472 true 1591;1573 $([MSBuild]::GetTargetFrameworkIdentifier('$(TargetFramework)')) @@ -15,11 +15,17 @@ Embeddable engine for the T4 templating language, a general-purpose way to generate text or code files using C# 2.2.1 readme.md + en-US - - + + + + + + + diff --git a/Mono.TextTemplating/Mono.TextTemplating/TemplateGenerator.cs b/Mono.TextTemplating/Mono.TextTemplating/TemplateGenerator.cs index 92a8666c..9cd4839d 100644 --- a/Mono.TextTemplating/Mono.TextTemplating/TemplateGenerator.cs +++ b/Mono.TextTemplating/Mono.TextTemplating/TemplateGenerator.cs @@ -388,7 +388,7 @@ internal static bool TryParseParameter (string parameter, out string processor, processor = directive = name = value = ""; int start = 0; - int end = parameter.IndexOfAny (new [] { '=', '!' }); + int end = parameter.IndexOfAny (parameterInitialSplitChars); if (end < 0) return false; @@ -573,6 +573,8 @@ public bool Equals (ParameterKey other) /// public virtual Type SpecificHostType { get { return null; } } + static readonly char[] parameterInitialSplitChars = new [] { '=', '!' }; + /// /// Gets any additional directive processors to be included in the processing run. /// diff --git a/Mono.TextTemplating/package/Mono.TextTemplating.targets b/Mono.TextTemplating/package/Mono.TextTemplating.targets new file mode 100644 index 00000000..53f00358 --- /dev/null +++ b/Mono.TextTemplating/package/Mono.TextTemplating.targets @@ -0,0 +1,6 @@ + + + + + diff --git a/Mono.TextTemplating/package/_._ b/Mono.TextTemplating/package/_._ new file mode 100644 index 00000000..e69de29b diff --git a/TextTransform/Options.cs b/TextTransform/Options.cs index ace030bc..aef0e2c3 100644 --- a/TextTransform/Options.cs +++ b/TextTransform/Options.cs @@ -756,7 +756,9 @@ public string OptionName { #if !PCL #pragma warning disable 618 // SecurityPermissionAttribute is obsolete +#pragma warning disable SYSLIB0003 // Type or member is obsolete [SecurityPermission (SecurityAction.LinkDemand, SerializationFormatter = true)] +#pragma warning restore SYSLIB0003 #pragma warning restore 618 public override void GetObjectData (SerializationInfo info, StreamingContext context) { diff --git a/TextTransform/TextTransform.cs b/TextTransform/TextTransform.cs index 5c02926e..25d01e44 100644 --- a/TextTransform/TextTransform.cs +++ b/TextTransform/TextTransform.cs @@ -32,7 +32,7 @@ namespace Mono.TextTemplating { - class TextTransform + sealed class TextTransform { static OptionSet optionSet; diff --git a/dotnet-t4/TextTransform.cs b/dotnet-t4/TextTransform.cs index 2b8e500c..3d4aecf8 100644 --- a/dotnet-t4/TextTransform.cs +++ b/dotnet-t4/TextTransform.cs @@ -32,7 +32,7 @@ namespace Mono.TextTemplating { - class TextTransform + sealed class TextTransform { static OptionSet optionSet; diff --git a/dotnet-t4/ToolTemplateGenerator.cs b/dotnet-t4/ToolTemplateGenerator.cs index f52d1352..d62e683c 100644 --- a/dotnet-t4/ToolTemplateGenerator.cs +++ b/dotnet-t4/ToolTemplateGenerator.cs @@ -25,7 +25,7 @@ namespace Mono.TextTemplating { - class ToolTemplateGenerator : TemplateGenerator + sealed class ToolTemplateGenerator : TemplateGenerator { public ToolTemplateGenerator () { diff --git a/dotnet-t4/ToolTemplateSession.cs b/dotnet-t4/ToolTemplateSession.cs index 8f00a03b..120522d7 100644 --- a/dotnet-t4/ToolTemplateSession.cs +++ b/dotnet-t4/ToolTemplateSession.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) Microsoft Corp (https://www.microsoft.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy @@ -27,7 +27,7 @@ namespace Mono.TextTemplating { - class ToolTemplateSession : ITextTemplatingSession + sealed class ToolTemplateSession : ITextTemplatingSession { readonly Dictionary session = new Dictionary (); readonly ToolTemplateGenerator toolTemplateGenerator; diff --git a/dotnet-t4/dotnet-t4.csproj b/dotnet-t4/dotnet-t4.csproj index ee7fff98..ac73fe4f 100644 --- a/dotnet-t4/dotnet-t4.csproj +++ b/dotnet-t4/dotnet-t4.csproj @@ -1,7 +1,7 @@ Exe - netcoreapp3.1 + net6.0 t4 dotnet-t4 LatestMajor @@ -21,6 +21,6 @@ - + diff --git a/version.json b/version.json index 0fba6df7..2afa9c08 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", - "version": "2.4.0-preview.{height}", + "version": "3.0.0-preview.{height}", "publicReleaseRefSpec": [ "^refs/tags/v\\d+\\.\\d+$", "^refs/tags/v\\d+\\.\\d+\\.\\d+$"