From fc77fdee36f062500590b16f62d3e395cc062451 Mon Sep 17 00:00:00 2001 From: GrahamTheCoder Date: Mon, 19 Dec 2022 00:03:48 +0000 Subject: [PATCH] Update to VS2022 17.2 only Needed codeanalysis >3.11 to avoid dotnet/msbuild#7873 Needed codeanalysis< 4.3 to avoid dotnet/roslyn#63780 There may have been other workarounds --- CodeConverter/CSharp/CommonConversions.cs | 2 +- .../ProjectMergedDeclarationExtensions.cs | 2 +- CodeConverter/CodeConverter.csproj | 20 +++++----- CodeConverter/Common/SymbolRenamer.cs | 2 +- .../CodeConv.NetFramework.csproj | 18 ++++----- CommandLine/CodeConv/CodeConv.csproj | 18 ++++----- Func/Func.csproj | 12 +++--- .../ExpressionTests/XmlExpressionTests.cs | 38 +++++++++---------- .../MultiFileSolutionAndProjectTests.cs | 4 +- Tests/Tests.csproj | 21 +++++----- Tests/VB/MultiFileSolutionAndProjectTests.cs | 4 +- Vsix/Vsix.csproj | 8 ++-- Web/Web.csproj | 4 +- 13 files changed, 77 insertions(+), 76 deletions(-) diff --git a/CodeConverter/CSharp/CommonConversions.cs b/CodeConverter/CSharp/CommonConversions.cs index c679343c9..8cf5ec574 100644 --- a/CodeConverter/CSharp/CommonConversions.cs +++ b/CodeConverter/CSharp/CommonConversions.cs @@ -553,7 +553,7 @@ public static CSSyntax.VariableDeclaratorSyntax CreateVariableDeclarator(string { if (operation is IPropertyReferenceOperation pro && pro.Arguments.Any() && !VisualBasicExtensions.IsDefault(pro.Property)) { - var isSetter = pro.Parent.Kind == OperationKind.SimpleAssignment && pro.Parent.Children.First() == pro; + var isSetter = pro.Parent.Kind == OperationKind.SimpleAssignment && pro.Parent.ChildOperations.First() == pro; var extraArg = isSetter ? await GetParameterizedSetterArgAsync(operation) : null; diff --git a/CodeConverter/CSharp/ProjectMergedDeclarationExtensions.cs b/CodeConverter/CSharp/ProjectMergedDeclarationExtensions.cs index cf41e9689..edd019226 100644 --- a/CodeConverter/CSharp/ProjectMergedDeclarationExtensions.cs +++ b/CodeConverter/CSharp/ProjectMergedDeclarationExtensions.cs @@ -164,7 +164,7 @@ private static async Task RenamePrefixAsync(Project project, string old for (var symbolToRename = await GetElementToRename(project); symbolToRename != null; symbolToRename = await GetElementToRename(project, toSkip)) { string newName = symbolToRename.Name.Replace(oldNamePrefix, newNamePrefix); try { - var renamedSolution = await Renamer.RenameSymbolAsync(project.Solution, symbolToRename, newName, project.Solution.Workspace.Options, cancellationToken); + var renamedSolution = await Renamer.RenameSymbolAsync(project.Solution, symbolToRename, new SymbolRenameOptions(), newName, cancellationToken); project = renamedSolution.GetProject(project.Id); } catch (Exception e) { toSkip++; diff --git a/CodeConverter/CodeConverter.csproj b/CodeConverter/CodeConverter.csproj index 6149d4161..4353eb311 100644 --- a/CodeConverter/CodeConverter.csproj +++ b/CodeConverter/CodeConverter.csproj @@ -31,28 +31,28 @@ - - + + - + all runtime; build; native; contentfiles; analyzers - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + + all - + diff --git a/CodeConverter/Common/SymbolRenamer.cs b/CodeConverter/Common/SymbolRenamer.cs index 0a687945a..a37aa7c6f 100644 --- a/CodeConverter/Common/SymbolRenamer.cs +++ b/CodeConverter/Common/SymbolRenamer.cs @@ -33,7 +33,7 @@ public static async Task PerformRenamesAsync(Project project, IEnumerab ISymbol currentDeclaration = SymbolFinder.FindSimilarSymbols(originalSymbol, compilation).FirstOrDefault(); if (currentDeclaration == null) continue; //Must have already renamed this symbol for a different reason - solution = await Renamer.RenameSymbolAsync(solution, currentDeclaration, newName, solution.Workspace.Options); + solution = await Renamer.RenameSymbolAsync(solution, currentDeclaration, new SymbolRenameOptions(), newName); } return solution.GetProject(project.Id); diff --git a/CommandLine/CodeConv.NetFramework/CodeConv.NetFramework.csproj b/CommandLine/CodeConv.NetFramework/CodeConv.NetFramework.csproj index a85ddf40e..56e99f8d0 100644 --- a/CommandLine/CodeConv.NetFramework/CodeConv.NetFramework.csproj +++ b/CommandLine/CodeConv.NetFramework/CodeConv.NetFramework.csproj @@ -10,18 +10,18 @@ - - - - - - - - + + + + + + + + - + diff --git a/CommandLine/CodeConv/CodeConv.csproj b/CommandLine/CodeConv/CodeConv.csproj index e17bf023a..40691337f 100644 --- a/CommandLine/CodeConv/CodeConv.csproj +++ b/CommandLine/CodeConv/CodeConv.csproj @@ -28,24 +28,24 @@ For a nugetted dll, web converter or visual studio extension, see https://github - - - - - + + + + + all runtime; build; native; contentfiles; analyzers - + - + - + - + diff --git a/Func/Func.csproj b/Func/Func.csproj index 6de48a209..ade5c78ff 100644 --- a/Func/Func.csproj +++ b/Func/Func.csproj @@ -14,14 +14,14 @@ - + - - - - - + + + + + diff --git a/Tests/CSharp/ExpressionTests/XmlExpressionTests.cs b/Tests/CSharp/ExpressionTests/XmlExpressionTests.cs index 60487caf3..b02d28d7b 100644 --- a/Tests/CSharp/ExpressionTests/XmlExpressionTests.cs +++ b/Tests/CSharp/ExpressionTests/XmlExpressionTests.cs @@ -116,34 +116,32 @@ private void TestMethod() { var catalog = new XDocument( new XElement(""Catalog"", -new XElement(""Book"", new XAttribute(""id"", ""bk101""), -new XElement(""Author"", ""Garghentini, Davide""), -new XElement(""Title"", ""XML Developer's Guide""), -new XElement(""Price"", ""44.95""), -new XElement(""Description"", ""\r\n An in-depth look at creating applications\r\n with "", new XElement(""technology"", ""XML""), "". For\r\n "", new XElement(""audience"", ""beginners""), "" or\r\n "", new XElement(""audience"", ""advanced""), "" developers.\r\n "") -), -new XElement(""Book"", new XAttribute(""id"", ""bk331""), -new XElement(""Author"", ""Spencer, Phil""), -new XElement(""Title"", ""Developing Applications with Visual Basic .NET""), -new XElement(""Price"", ""45.95""), -new XElement(""Description"", ""\r\n Get the expert insights, practical code samples,\r\n and best practices you need\r\n to advance your expertise with "", new XElement(""technology"", ""Visual\r\n Basic .NET""), "".\r\n Learn how to create faster, more reliable applications\r\n based on professional,\r\n pragmatic guidance by today's top "", new XElement(""audience"", ""developers""), "".\r\n "") -) + new XElement(""Book"", new XAttribute(""id"", ""bk101""), + new XElement(""Author"", ""Garghentini, Davide""), + new XElement(""Title"", ""XML Developer's Guide""), + new XElement(""Price"", ""44.95""), + new XElement(""Description"", ""\r\n An in-depth look at creating applications\r\n with "", new XElement(""technology"", ""XML""), "". For\r\n "", new XElement(""audience"", ""beginners""), "" or\r\n "", new XElement(""audience"", ""advanced""), "" developers.\r\n "") + ), + new XElement(""Book"", new XAttribute(""id"", ""bk331""), + new XElement(""Author"", ""Spencer, Phil""), + new XElement(""Title"", ""Developing Applications with Visual Basic .NET""), + new XElement(""Price"", ""45.95""), + new XElement(""Description"", ""\r\n Get the expert insights, practical code samples,\r\n and best practices you need\r\n to advance your expertise with "", new XElement(""technology"", ""Visual\r\n Basic .NET""), "".\r\n Learn how to create faster, more reliable applications\r\n based on professional,\r\n pragmatic guidance by today's top "", new XElement(""audience"", ""developers""), "".\r\n "") + ) ) ); var htmlOutput = new XElement(""html"", - new XElement(""body"", from book in catalog.Elements(""Catalog"").Elements(""Book"") select new XElement(""div"", - new XElement(""h1"", book.Elements(""Title"").Value), - new XElement(""h3"", ""By "" + book.Elements(""Author"").Value), - new XElement(""h3"", ""Price = "" + book.Elements(""Price"").Value), - + new XElement(""h1"", book.Elements(""Title"").Value), + new XElement(""h3"", ""By "" + book.Elements(""Author"").Value), + new XElement(""h3"", ""Price = "" + book.Elements(""Price"").Value), new XElement(""h2"", ""Description""), TransformDescription((string)book.Elements(""Description"").ElementAtOrDefault(0)), new XElement(""hr"") - ) - ) - ); + ) + ) + ); } public string TransformDescription(string s) diff --git a/Tests/CSharp/MultiFileSolutionAndProjectTests.cs b/Tests/CSharp/MultiFileSolutionAndProjectTests.cs index 250db8214..343def9af 100644 --- a/Tests/CSharp/MultiFileSolutionAndProjectTests.cs +++ b/Tests/CSharp/MultiFileSolutionAndProjectTests.cs @@ -18,14 +18,14 @@ public MultiFileSolutionAndProjectTests(MultiFileTestFixture multiFileTestFixtur _multiFileTestFixture = multiFileTestFixture; } - //[Fact] /* enable for executing locally */ + [Fact] /* enable for executing locally */ public async Task ConvertWholeSolutionAsync() { await _multiFileTestFixture.ConvertProjectsWhereAsync(p => true, Language.CS); } - //[Fact] /* enable for executing locally */ + [Fact] /* enable for executing locally */ public async Task ConvertVbLibraryOnlyAsync() { await _multiFileTestFixture.ConvertProjectsWhereAsync(p => p.Name == "VbLibrary", Language.CS); diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj index eb4a39f06..8a5af6fb6 100644 --- a/Tests/Tests.csproj +++ b/Tests/Tests.csproj @@ -9,9 +9,12 @@ true - - - + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + @@ -27,12 +30,12 @@ - - - - - - + + + + + + diff --git a/Tests/VB/MultiFileSolutionAndProjectTests.cs b/Tests/VB/MultiFileSolutionAndProjectTests.cs index 5c9204dcc..4adb543d2 100644 --- a/Tests/VB/MultiFileSolutionAndProjectTests.cs +++ b/Tests/VB/MultiFileSolutionAndProjectTests.cs @@ -18,13 +18,13 @@ public MultiFileSolutionAndProjectTests(MultiFileTestFixture multiFileTestFixtur _multiFileTestFixture = multiFileTestFixture; } - //[Fact] /* enable for executing locally */ + [Fact] /* enable for executing locally */ public async Task ConvertWholeSolutionAsync() { await _multiFileTestFixture.ConvertProjectsWhereAsync(p => true, Language.VB); } - //[Fact] /* enable for executing locally */ + [Fact] /* enable for executing locally */ public async Task ConvertCSharpConsoleAppOnlyAsync() { await _multiFileTestFixture.ConvertProjectsWhereAsync(p => p.Name == "CSharpConsoleApp", Language.VB); diff --git a/Vsix/Vsix.csproj b/Vsix/Vsix.csproj index d64831242..1503318f1 100644 --- a/Vsix/Vsix.csproj +++ b/Vsix/Vsix.csproj @@ -50,13 +50,13 @@ 4 - - - + + + compile; build; native; contentfiles; analyzers; buildtransitive - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/Web/Web.csproj b/Web/Web.csproj index 9d2bad4e7..ba38f8456 100644 --- a/Web/Web.csproj +++ b/Web/Web.csproj @@ -21,8 +21,8 @@ - - + +