Skip to content

Commit

Permalink
Update to VS2022 17.2 only
Browse files Browse the repository at this point in the history
Needed codeanalysis >3.11 to avoid dotnet/msbuild#7873
Needed codeanalysis< 4.3 to avoid dotnet/roslyn#63780

There may have been other workarounds
  • Loading branch information
GrahamTheCoder committed Dec 19, 2022
1 parent d88f78e commit fc77fde
Show file tree
Hide file tree
Showing 13 changed files with 77 additions and 76 deletions.
2 changes: 1 addition & 1 deletion CodeConverter/CSharp/CommonConversions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion CodeConverter/CSharp/ProjectMergedDeclarationExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ private static async Task<Project> 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++;
Expand Down
20 changes: 10 additions & 10 deletions CodeConverter/CodeConverter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,28 +31,28 @@
<EmbeddedResource Include="Common\DefaultReferences.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="3.11.0" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic.Workspaces" Version="3.11.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.2.0" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic.Workspaces" Version="4.2.0" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.VisualBasic" Version="10.3.0" />
<PackageReference Include="Microsoft.VisualStudio.Composition" Version="16.9.20" />
<PackageReference Include="Microsoft.VisualStudio.Threading" Version="16.10.56" />
<PackageReference Include="Nullable" Version="1.3.0">
<PackageReference Include="Microsoft.VisualStudio.Composition" Version="17.2.41" />
<PackageReference Include="Microsoft.VisualStudio.Threading" Version="17.2.32" />
<PackageReference Include="Nullable" Version="1.3.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<PackageReference Include="System.Globalization.Extensions" Version="4.3.0" />
<PackageReference Include="System.IO.Abstractions" Version="13.2.33" />
<PackageReference Include="System.Linq.Async" Version="4.0.0" />
<PackageReference Include="System.Threading.Tasks.Dataflow" Version="5.0.0">
<PackageReference Include="System.IO.Abstractions" Version="19.1.1" />
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
<PackageReference Include="System.Threading.Tasks.Dataflow" Version="6.0.0">
<IncludeAssets>all</IncludeAssets>
</PackageReference>
<PackageReference Include="IsExternalInit" Version="1.0.2" PrivateAssets="all" />
<PackageReference Include="IsExternalInit" Version="1.0.3" PrivateAssets="all" />
</ItemGroup>
<!-- The InternalVisibleTo fails when building with signing -->
<ItemGroup Condition="'$(SignAssembly)'=='True'">
Expand Down
2 changes: 1 addition & 1 deletion CodeConverter/Common/SymbolRenamer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static async Task<Project> 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);
Expand Down
18 changes: 9 additions & 9 deletions CommandLine/CodeConv.NetFramework/CodeConv.NetFramework.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="5.0.0" />
<PackageReference Include="Microsoft.Build.Locator" Version="1.2.6" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="3.11.0" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic.Workspaces" Version="3.11.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="3.11.0" />
<PackageReference Include="Microsoft.VisualStudio.Threading" Version="16.10.56" />
<PackageReference Include="NuGet.Build.Tasks" Version="5.4.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.7.0" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="6.0.0" />
<PackageReference Include="Microsoft.Build.Locator" Version="1.5.5" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.2.0" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic.Workspaces" Version="4.2.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.2.0" />
<PackageReference Include="Microsoft.VisualStudio.Threading" Version="17.2.32" />
<PackageReference Include="NuGet.Build.Tasks" Version="6.4.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.1" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.5" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />

<PackageReference Include="McMaster.Extensions.CommandLineUtils" Version="3.0.0" />
<PackageReference Include="McMaster.Extensions.CommandLineUtils" Version="4.0.2" />
</ItemGroup>

<ItemGroup>
Expand Down
18 changes: 9 additions & 9 deletions CommandLine/CodeConv/CodeConv.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,24 @@ For a nugetted dll, web converter or visual studio extension, see https://github
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="5.0.0" />
<PackageReference Include="Microsoft.Build.Locator" Version="1.4.1" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.1.0" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic.Workspaces" Version="4.1.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.1.0" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="6.0.0" />
<PackageReference Include="Microsoft.Build.Locator" Version="1.5.5" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.2.0" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic.Workspaces" Version="4.2.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.2.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Threading" Version="16.10.56" />
<PackageReference Include="Microsoft.VisualStudio.Threading" Version="17.2.32" />
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" />
<PackageReference Include="NuGet.Build.Tasks" Version="6.1.0" />
<PackageReference Include="NuGet.Build.Tasks" Version="6.4.0" />
<PackageReference Include="System.CodeDom" Version="6.0.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.1" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.5" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />

<PackageReference Include="McMaster.Extensions.CommandLineUtils" Version="4.0.1" />
<PackageReference Include="McMaster.Extensions.CommandLineUtils" Version="4.0.2" />
</ItemGroup>

<ItemGroup>
Expand Down
12 changes: 6 additions & 6 deletions Func/Func.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.1.0" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.0.1" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.1.3" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="6.0.0" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.5" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.11.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="3.11.0" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic" Version="3.11.0" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic.Workspaces" Version="3.11.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="3.11.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.2.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.2.0" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic" Version="4.2.0" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic.Workspaces" Version="4.2.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.2.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CodeConverter\CodeConverter.csproj" />
Expand Down
38 changes: 18 additions & 20 deletions Tests/CSharp/ExpressionTests/XmlExpressionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions Tests/CSharp/MultiFileSolutionAndProjectTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
21 changes: 12 additions & 9 deletions Tests/Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Moq" Version="4.16.1" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
<PackageReference Include="Moq" Version="4.18.3" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
Expand All @@ -27,12 +30,12 @@
<ProjectReference Include="..\CommandLine\CodeConv.NetFramework\CodeConv.NetFramework.csproj" />
</ItemGroup>
<ItemGroup Label="ReSharper test runner requirements - test against latest Visual Studio version">
<PackageReference Include="Microsoft.CodeAnalysis.Features" Version="4.1.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.1.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.1.0" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic.Workspaces" Version="4.1.0" />
<PackageReference Include="Microsoft.Build" Version="17.0.0" />
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="17.0.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Features" Version="4.2.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.2.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.2.0" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic.Workspaces" Version="4.2.0" />
<PackageReference Include="Microsoft.Build" Version="17.4.0" />
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="17.4.0" />
</ItemGroup>
<ItemGroup>
<Reference Include="System.Web" />
Expand Down
4 changes: 2 additions & 2 deletions Tests/VB/MultiFileSolutionAndProjectTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions Vsix/Vsix.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<!-- Build against VS 16.10 -->
<PackageReference Include="Microsoft.VisualStudio.LanguageServices" Version="3.11.0" />
<PackageReference Include="Microsoft.VisualStudio.SDK" Version="16.10.31321.278" ExcludeAssets="runtime">
<!-- Build against VS 17.2+ API -->
<PackageReference Include="Microsoft.VisualStudio.LanguageServices" Version="4.2.0" />
<PackageReference Include="Microsoft.VisualStudio.SDK" Version="17.2.32505.173" ExcludeAssets="runtime">
<IncludeAssets>compile; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<!-- Avoids needing the VSSDK MSI installed. Version is the VS version used during compilation, not where the VSIX will be installed -->
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="17.1.4054">
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="17.4.2119">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
4 changes: 2 additions & 2 deletions Web/Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

<ItemGroup>
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="6.0.0" />
<PackageReference Include="Microsoft.AspNetCore.SpaProxy" Version="6.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
<PackageReference Include="Microsoft.AspNetCore.SpaProxy" Version="7.0.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.5" />
</ItemGroup>

Expand Down

0 comments on commit fc77fde

Please sign in to comment.