Skip to content

Commit 8c9426e

Browse files
committed
migrate projects to new csproj format (Sdk="Microsoft.NET.Sdk")
1 parent d551870 commit 8c9426e

File tree

16 files changed

+106
-451
lines changed

16 files changed

+106
-451
lines changed

BitFields.sln

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ VisualStudioVersion = 15.0.26403.7
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{36A89821-EC52-4181-B9AE-29ECE656397E}"
77
EndProject
8-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BitFields", "src\BitFields\BitFields.csproj", "{C19FE8B5-D129-45DD-A695-BCEC62BAFF49}"
9-
EndProject
108
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "experimental", "experimental", "{BB961ACF-FF36-4F16-8C0F-8BC5E6BDDF84}"
119
EndProject
10+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BitFields", "src\BitFields\BitFields.csproj", "{C19FE8B5-D129-45DD-A695-BCEC62BAFF49}"
11+
EndProject
1212
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApp1", "experimental\ConsoleApp1\ConsoleApp1.csproj", "{363F4419-1E1D-4760-80FA-26FE7F332C6C}"
1313
EndProject
1414
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GenericBits", "experimental\GenericBits\GenericBits.csproj", "{1991D425-2FF4-4D0C-8453-BC9B89005F99}"
1515
EndProject
1616
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TypeClassBits", "experimental\TypeClassBits\TypeClassBits.csproj", "{50A4BC0C-EF7B-420D-8AE0-CDE0851F0424}"
1717
EndProject
18-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BitFieldsAnalyzer", "src\BitFieldsAnalyzer\BitFieldsAnalyzer\BitFieldsAnalyzer.csproj", "{EE4CFF3F-5F05-44B6-A12D-AB0BA23D1BF1}"
18+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BitFieldsAnalyzer", "src\BitFieldsAnalyzer\BitFieldsAnalyzer\BitFieldsAnalyzer.csproj", "{EE4CFF3F-5F05-44B6-A12D-AB0BA23D1BF1}"
1919
EndProject
2020
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BitFieldsAnalyzer.Test", "src\BitFieldsAnalyzer\BitFieldsAnalyzer.Test\BitFieldsAnalyzer.Test.csproj", "{BB2F0E80-A4AF-47C5-84DC-D10B6180403F}"
2121
EndProject

experimental/ConsoleApp1/BitFields/Program.cs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System;
1+
using BitFields;
2+
using System;
23

34
namespace ConsoleApp1.BitFields
45
{
@@ -13,6 +14,25 @@ public static void Run()
1314
v.Fraction = 0xE_0000_0000_0000; // 1.111b
1415

1516
Console.WriteLine(v.AsDouble()); // -15
17+
18+
Bit3 x = 1;
19+
x = 4;
20+
x = 10;
21+
}
22+
23+
Bit2 x = 1;
24+
Bit2 y = 4;
25+
26+
Bit1 X { get; } = 1;
27+
Bit1 Y { get; } = 2;
28+
29+
void A()
30+
{
31+
A(1);
32+
A(2);
1633
}
34+
void A(Bit1 x) { }
35+
Bit1 F() => 2;
36+
Bit1 Z => 2;
1737
}
1838
}
Lines changed: 9 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -1,108 +1,24 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<!-- Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -->
3-
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
1+
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
42
<PropertyGroup>
5-
<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
6-
<Platform Condition="'$(Platform)' == ''">AnyCPU</Platform>
7-
<PlatformTarget>AnyCPU</PlatformTarget>
8-
<ProductVersion>8.0.30703</ProductVersion>
9-
<SchemaVersion>2.0</SchemaVersion>
10-
<ProjectGuid>{BB2F0E80-A4AF-47C5-84DC-D10B6180403F}</ProjectGuid>
113
<OutputType>Library</OutputType>
124
<AppDesignerFolder>Properties</AppDesignerFolder>
135
<RootNamespace>BitFieldsAnalyzer.Test</RootNamespace>
146
<AssemblyName>BitFieldsAnalyzer.Test</AssemblyName>
15-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
16-
<FileAlignment>512</FileAlignment>
17-
<TargetFrameworkProfile />
7+
<TargetFramework>netcoreapp1.0</TargetFramework>
8+
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">$(PackageTargetFallback);portable-net45+win8+wp8+wpa81</PackageTargetFallback>
189
</PropertyGroup>
19-
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
20-
<DebugSymbols>true</DebugSymbols>
21-
<DebugType>full</DebugType>
22-
<Optimize>false</Optimize>
23-
<OutputPath>bin\Debug\</OutputPath>
24-
<DefineConstants>DEBUG;TRACE</DefineConstants>
25-
<ErrorReport>prompt</ErrorReport>
26-
<WarningLevel>4</WarningLevel>
27-
<Prefer32Bit>false</Prefer32Bit>
28-
</PropertyGroup>
29-
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
30-
<DebugType>pdbonly</DebugType>
31-
<Optimize>true</Optimize>
32-
<OutputPath>bin\Release\</OutputPath>
33-
<DefineConstants>TRACE</DefineConstants>
34-
<ErrorReport>prompt</ErrorReport>
35-
<WarningLevel>4</WarningLevel>
36-
<Prefer32Bit>false</Prefer32Bit>
37-
</PropertyGroup>
38-
<ItemGroup>
39-
<Reference Include="Microsoft.CodeAnalysis, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
40-
<HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.1\lib\net45\Microsoft.CodeAnalysis.dll</HintPath>
41-
</Reference>
42-
<Reference Include="Microsoft.CodeAnalysis.CSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
43-
<HintPath>..\..\..\packages\Microsoft.CodeAnalysis.CSharp.1.0.1\lib\net45\Microsoft.CodeAnalysis.CSharp.dll</HintPath>
44-
</Reference>
45-
<Reference Include="Microsoft.CodeAnalysis.CSharp.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
46-
<HintPath>..\..\..\packages\Microsoft.CodeAnalysis.CSharp.Workspaces.1.0.1\lib\net45\Microsoft.CodeAnalysis.CSharp.Workspaces.dll</HintPath>
47-
</Reference>
48-
<Reference Include="Microsoft.CodeAnalysis.VisualBasic, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
49-
<HintPath>..\..\..\packages\Microsoft.CodeAnalysis.VisualBasic.1.0.1\lib\net45\Microsoft.CodeAnalysis.VisualBasic.dll</HintPath>
50-
</Reference>
51-
<Reference Include="Microsoft.CodeAnalysis.VisualBasic.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
52-
<HintPath>..\..\..\packages\Microsoft.CodeAnalysis.VisualBasic.Workspaces.1.0.1\lib\net45\Microsoft.CodeAnalysis.VisualBasic.Workspaces.dll</HintPath>
53-
</Reference>
54-
<Reference Include="Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
55-
<HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.0.1\lib\net45\Microsoft.CodeAnalysis.Workspaces.dll</HintPath>
56-
</Reference>
57-
<Reference Include="System" />
58-
<Reference Include="System.Collections.Immutable, Version=1.1.36.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
59-
<HintPath>..\..\..\packages\System.Collections.Immutable.1.1.36\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
60-
</Reference>
61-
<Reference Include="System.Composition.AttributedModel, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
62-
<HintPath>..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.AttributedModel.dll</HintPath>
63-
</Reference>
64-
<Reference Include="System.Composition.Convention, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
65-
<HintPath>..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Convention.dll</HintPath>
66-
</Reference>
67-
<Reference Include="System.Composition.Hosting, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
68-
<HintPath>..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Hosting.dll</HintPath>
69-
</Reference>
70-
<Reference Include="System.Composition.Runtime, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
71-
<HintPath>..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Runtime.dll</HintPath>
72-
</Reference>
73-
<Reference Include="System.Composition.TypedParts, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
74-
<HintPath>..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.TypedParts.dll</HintPath>
75-
</Reference>
76-
<Reference Include="System.Core" />
77-
<Reference Include="System.Reflection.Metadata, Version=1.0.21.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
78-
<HintPath>..\..\..\packages\System.Reflection.Metadata.1.0.21\lib\portable-net45+win8\System.Reflection.Metadata.dll</HintPath>
79-
</Reference>
80-
<Reference Include="System.Xml.Linq" />
81-
<Reference Include="System.Data.DataSetExtensions" />
82-
<Reference Include="Microsoft.CSharp" />
83-
<Reference Include="System.Data" />
84-
<Reference Include="System.Xml" />
85-
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework">
86-
<Private>false</Private>
87-
</Reference>
88-
</ItemGroup>
8910
<ItemGroup>
90-
<Compile Include="Verifiers\CodeFixVerifier.cs" />
91-
<Compile Include="Verifiers\DiagnosticVerifier.cs" />
92-
<Compile Include="Helpers\CodeFixVerifier.Helper.cs" />
93-
<Compile Include="Helpers\DiagnosticResult.cs" />
94-
<Compile Include="Helpers\DiagnosticVerifier.Helper.cs" />
95-
<Compile Include="UnitTests.cs" />
96-
<Compile Include="Properties\AssemblyInfo.cs" />
97-
</ItemGroup>
98-
<ItemGroup>
99-
<None Include="packages.config" />
11+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
12+
<PackageReference Include="xunit" Version="2.2.0" />
13+
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
10014
</ItemGroup>
10115
<ItemGroup>
10216
<ProjectReference Include="..\BitFieldsAnalyzer\BitFieldsAnalyzer.csproj">
10317
<Project>{EE4CFF3F-5F05-44B6-A12D-AB0BA23D1BF1}</Project>
10418
<Name>BitFieldsAnalyzer</Name>
10519
</ProjectReference>
10620
</ItemGroup>
107-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
21+
<ItemGroup>
22+
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
23+
</ItemGroup>
10824
</Project>

src/BitFieldsAnalyzer/BitFieldsAnalyzer.Test/Helpers/DiagnosticVerifier.Helper.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System.Collections.Generic;
77
using System.Collections.Immutable;
88
using System.Linq;
9+
using System.Reflection;
910

1011
namespace TestHelper
1112
{
@@ -15,10 +16,10 @@ namespace TestHelper
1516
/// </summary>
1617
public abstract partial class DiagnosticVerifier
1718
{
18-
private static readonly MetadataReference CorlibReference = MetadataReference.CreateFromFile(typeof(object).Assembly.Location);
19-
private static readonly MetadataReference SystemCoreReference = MetadataReference.CreateFromFile(typeof(Enumerable).Assembly.Location);
20-
private static readonly MetadataReference CSharpSymbolsReference = MetadataReference.CreateFromFile(typeof(CSharpCompilation).Assembly.Location);
21-
private static readonly MetadataReference CodeAnalysisReference = MetadataReference.CreateFromFile(typeof(Compilation).Assembly.Location);
19+
private static readonly MetadataReference CorlibReference = MetadataReference.CreateFromFile(typeof(object).GetTypeInfo().Assembly.Location);
20+
private static readonly MetadataReference SystemCoreReference = MetadataReference.CreateFromFile(typeof(Enumerable).GetTypeInfo().Assembly.Location);
21+
private static readonly MetadataReference CSharpSymbolsReference = MetadataReference.CreateFromFile(typeof(CSharpCompilation).GetTypeInfo().Assembly.Location);
22+
private static readonly MetadataReference CodeAnalysisReference = MetadataReference.CreateFromFile(typeof(Compilation).GetTypeInfo().Assembly.Location);
2223

2324
internal static string DefaultFilePathPrefix = "Test";
2425
internal static string CSharpDefaultFileExt = "cs";
@@ -116,7 +117,7 @@ private static Document[] GetDocuments(string[] sources, string language)
116117

117118
if (sources.Length != documents.Length)
118119
{
119-
throw new SystemException("Amount of sources did not match amount of Documents created");
120+
throw new InvalidOperationException("Amount of sources did not match amount of Documents created");
120121
}
121122

122123
return documents;

src/BitFieldsAnalyzer/BitFieldsAnalyzer.Test/Properties/AssemblyInfo.cs

Lines changed: 0 additions & 32 deletions
This file was deleted.

src/BitFieldsAnalyzer/BitFieldsAnalyzer.Test/UnitTests.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
using Microsoft.CodeAnalysis;
22
using Microsoft.CodeAnalysis.CodeFixes;
33
using Microsoft.CodeAnalysis.Diagnostics;
4-
using Microsoft.VisualStudio.TestTools.UnitTesting;
54
using System;
65
using TestHelper;
76
using BitFieldsAnalyzer;
7+
using Xunit;
88

99
namespace BitFieldsAnalyzer.Test
1010
{
11-
[TestClass]
1211
public class UnitTest : CodeFixVerifier
1312
{
1413

1514
//No diagnostics expected to show up
16-
[TestMethod]
15+
[Fact]
1716
public void TestMethod1()
1817
{
1918
var test = @"";
@@ -22,7 +21,7 @@ public void TestMethod1()
2221
}
2322

2423
//Diagnostic and CodeFix both triggered and checked for
25-
[TestMethod]
24+
[Fact]
2625
public void TestMethod2()
2726
{
2827
var test = @"

src/BitFieldsAnalyzer/BitFieldsAnalyzer.Test/Verifiers/CodeFixVerifier.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
using Microsoft.CodeAnalysis.CodeFixes;
44
using Microsoft.CodeAnalysis.Diagnostics;
55
using Microsoft.CodeAnalysis.Formatting;
6-
using Microsoft.VisualStudio.TestTools.UnitTesting;
76
using System.Collections.Generic;
87
using System.Linq;
98
using System.Threading;
9+
using Xunit;
1010

1111
namespace TestHelper
1212
{
@@ -107,7 +107,7 @@ private void VerifyFix(string language, DiagnosticAnalyzer analyzer, CodeFixProv
107107
document = document.WithSyntaxRoot(Formatter.Format(document.GetSyntaxRootAsync().Result, Formatter.Annotation, document.Project.Solution.Workspace));
108108
newCompilerDiagnostics = GetNewDiagnostics(compilerDiagnostics, GetCompilerDiagnostics(document));
109109

110-
Assert.IsTrue(false,
110+
Assert.True(false,
111111
string.Format("Fix introduced new compiler diagnostics:\r\n{0}\r\n\r\nNew document:\r\n{1}\r\n",
112112
string.Join("\r\n", newCompilerDiagnostics.Select(d => d.ToString())),
113113
document.GetSyntaxRootAsync().Result.ToFullString()));
@@ -122,7 +122,7 @@ private void VerifyFix(string language, DiagnosticAnalyzer analyzer, CodeFixProv
122122

123123
//after applying all of the code fixes, compare the resulting string to the inputted one
124124
var actual = GetStringFromDocument(document);
125-
Assert.AreEqual(newSource, actual);
125+
Assert.Equal(newSource, actual);
126126
}
127127
}
128128
}

0 commit comments

Comments
 (0)