Skip to content

Commit

Permalink
⬆️ Upgrade tests and sample app to net6.0, upgrade all nugets
Browse files Browse the repository at this point in the history
  • Loading branch information
angularsen committed Oct 1, 2022
1 parent 820c79c commit 907bd55
Show file tree
Hide file tree
Showing 16 changed files with 132 additions and 182 deletions.
15 changes: 9 additions & 6 deletions AssignAll/AssignAll.Test/AssignAll.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="2.9.8">
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.3.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
<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>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="3.4.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions AssignAll/AssignAll/AssignAll.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@

<!-- Enable Source Link for GitHub repo -->
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="2.9.8" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="3.4.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.3" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.3.1" PrivateAssets="all" />
<PackageReference Update="NETStandard.Library" PrivateAssets="all" />
</ItemGroup>

Expand Down
12 changes: 6 additions & 6 deletions RoslynAnalyzers.sln
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AssignAll.Test", "AssignAll
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AssignAll.Vsix", "AssignAll\AssignAll.Vsix\AssignAll.Vsix.csproj", "{B176E12E-F1EB-4776-9D13-3F4E9064E08D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleConsoleApp", "SampleConsoleApp\SampleConsoleApp.csproj", "{50FFCAEA-07D5-493E-8904-DEE6A7D9BE0D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Files", "Files", "{D4A0A564-543B-4220-8194-F1E7447A4E2D}"
ProjectSection(SolutionItems) = preProject
appveyor.yml = appveyor.yml
README.md = README.md
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Samples.ConsoleNet6", "Samples.ConsoleNet6\Samples.ConsoleNet6.csproj", "{4A5DE914-8128-4CA6-87CE-0B9A9F2B91FE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -35,10 +35,10 @@ Global
{B176E12E-F1EB-4776-9D13-3F4E9064E08D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B176E12E-F1EB-4776-9D13-3F4E9064E08D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B176E12E-F1EB-4776-9D13-3F4E9064E08D}.Release|Any CPU.Build.0 = Release|Any CPU
{50FFCAEA-07D5-493E-8904-DEE6A7D9BE0D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{50FFCAEA-07D5-493E-8904-DEE6A7D9BE0D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{50FFCAEA-07D5-493E-8904-DEE6A7D9BE0D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{50FFCAEA-07D5-493E-8904-DEE6A7D9BE0D}.Release|Any CPU.Build.0 = Release|Any CPU
{4A5DE914-8128-4CA6-87CE-0B9A9F2B91FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4A5DE914-8128-4CA6-87CE-0B9A9F2B91FE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4A5DE914-8128-4CA6-87CE-0B9A9F2B91FE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4A5DE914-8128-4CA6-87CE-0B9A9F2B91FE}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
4 changes: 0 additions & 4 deletions SampleConsoleApp/.gitattributes

This file was deleted.

7 changes: 0 additions & 7 deletions SampleConsoleApp/App.config

This file was deleted.

32 changes: 0 additions & 32 deletions SampleConsoleApp/Program.cs

This file was deleted.

39 changes: 0 additions & 39 deletions SampleConsoleApp/Properties/AssemblyInfo.cs

This file was deleted.

55 changes: 0 additions & 55 deletions SampleConsoleApp/SampleConsoleApp.csproj

This file was deleted.

30 changes: 0 additions & 30 deletions SampleConsoleApp/SampleConsoleApp.sln

This file was deleted.

File renamed without changes.
32 changes: 32 additions & 0 deletions Samples.ConsoleNet6/Example001_TopLevelStatements.Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// AssignAll enable

// EXAMPLE 001 - Top level statements in the single main file, typically Program.cs.
// https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/program-structure/top-level-statements
//
// This should give analyzer error:
// Missing member assignments in object initializer for type 'Foo'. Properties: PropUnassigned
var foo = new Foo
{
// Commented assignments after opening brace. OK by analyzer.
// PropCommented1 = 1,

// Assigned property. OK by analyzer
PropAssigned = 1,

// Commented assignments just before closing brace. OK by analyzer.
//PropCommented2 = ,
// PropCommented3=,
};

Console.WriteLine($"Hello, {foo}!");

// Add methods and nested types available to top level statements via a partial Program class.
// ReSharper disable once UnusedType.Global
public static partial class Program
{
private class Foo2
{
public int PropInt { get; set; }
public string PropString { get; set; }
}
}
25 changes: 25 additions & 0 deletions Samples.ConsoleNet6/Example002_FileScopedNamespace.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// AssignAll enable
// EXAMPLE 002 - File-scoped namespaces.
// https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-10.0/file-scoped-namespaces
namespace Samples.ConsoleNet6;

public static class Example002_FileScopedNamespace
{
public static void Irrelevant()
{
// This should give analyzer error:
// Missing member assignments in object initializer for type 'Foo'. Properties: PropUnassigned
var foo = new Foo
{
// Commented assignments after opening brace.
// PropCommented1 = 1,

// Assigned property, OK by analyzer
PropAssigned = 1,

// Commented assignments just before closing brace
//PropCommented2 = ,
// PropCommented3=,
};
}
}
26 changes: 26 additions & 0 deletions Samples.ConsoleNet6/Example003_RegularNamespaceDeclaration.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// AssignAll enable
// EXAMPLE 003 - Regular namespace declarations with a body.
// https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-10.0/file-scoped-namespaces
namespace Samples.ConsoleNet6
{
public static class Example003_RegularNamespaceDeclaration
{
public static void Irrelevant()
{
// This should give analyzer error:
// Missing member assignments in object initializer for type 'Foo'. Properties: PropUnassigned
var foo = new Foo
{
// Commented assignments after opening brace.
// PropCommented1 = 1,

// Assigned property, OK by analyzer
PropAssigned = 1,

// Commented assignments just before closing brace
//PropCommented2 = ,
// PropCommented3=,
};
}
}
}
10 changes: 10 additions & 0 deletions Samples.ConsoleNet6/Foo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Samples.ConsoleNet6;

internal class Foo
{
public int PropAssigned { get; set; }
public int PropCommented1 { get; set; }
public int PropCommented2 { get; set; }
public int PropCommented3 { get; set; }
public int PropUnassigned { get; set; }
}
3 changes: 3 additions & 0 deletions Samples.ConsoleNet6/GlobalUsings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Global using directives

global using Samples.ConsoleNet6;
18 changes: 18 additions & 0 deletions Samples.ConsoleNet6/Samples.ConsoleNet6.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<Content Include=".editorconfig" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="AssignAll" Version="1.5.0" />
</ItemGroup>

</Project>

0 comments on commit 907bd55

Please sign in to comment.