Skip to content
This repository was archived by the owner on Jul 12, 2022. It is now read-only.

Commit 38ef57a

Browse files
authored
Merge pull request #275 from ericstj/convertSDK
Convert codeformatter to SDK projects and update to latest dependencies
2 parents ea592c2 + 38a6bb6 commit 38ef57a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+233
-1408
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ bld/
2020
[Bb]in/
2121
[Oo]bj/
2222
msbuild.log
23+
*.binlog
24+
25+
.vs/
2326

2427
# Roslyn stuff
2528
*.sln.ide

Directory.Build.props

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)' == ''">$(MSBuildThisFileDirectory)obj\$(MSBuildProjectName)\</BaseIntermediateOutputPath>
5+
<BaseOutputPath Condition="'$(BaseOutputPath)' == ''">$(MSBuildThisFileDirectory)bin\$(MSBuildProjectName)\</BaseOutputPath>
6+
<Authors Condition="'$(Authors)' == ''">Microsoft Corporation</Authors>
7+
</PropertyGroup>
8+
9+
<Import Project="dependencies.props" />
10+
</Project>

NuGet.config

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<fallbackPackageFolders>
4+
<clear />
5+
</fallbackPackageFolders>
6+
<packageSources>
7+
<clear/>
8+
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
9+
</packageSources>
10+
</configuration>

build.cmd

+22-26
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,31 @@ SETLOCAL
44

55
SET CACHED_NUGET=%LocalAppData%\NuGet\NuGet.exe
66
SET SOLUTION_PATH="%~dp0src\CodeFormatter.sln"
7-
SET MSBUILD14_TOOLS_PATH="%ProgramFiles(x86)%\MSBuild\14.0\bin\MSBuild.exe"
8-
SET MSBUILD12_TOOLS_PATH="%ProgramFiles(x86)%\MSBuild\12.0\bin\MSBuild.exe"
9-
SET BUILD_TOOLS_PATH=%MSBUILD14_TOOLS_PATH%
7+
SET VSWHERELOCATION="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
8+
9+
IF NOT EXIST %VSWHERELOCATION% (
10+
goto :error
11+
)
12+
13+
for /f "usebackq tokens=*" %%i in (`%VSWHERELOCATION% -latest -prerelease -products * -requires Microsoft.Component.MSBuild -property installationPath`) do (
14+
set BUILD_TOOLS_PATH="%%i\MSBuild\15.0\Bin\MSBuild.exe"
15+
)
1016

11-
IF NOT EXIST %MSBUILD14_TOOLS_PATH% (
12-
echo In order to run this tool you need either Visual Studio 2015 or
13-
echo Microsoft Build Tools 2015 tools installed.
14-
echo.
15-
echo Visit this page to download either:
16-
echo.
17-
echo http://www.visualstudio.com/en-us/downloads/visual-studio-2015-downloads-vs
18-
echo.
19-
echo Attempting to fall back to MSBuild 12 for building only
20-
echo.
21-
IF NOT EXIST %MSBUILD12_TOOLS_PATH% (
22-
echo Could not find MSBuild 12. Please install build tools ^(See above^)
23-
exit /b 1
24-
) else (
25-
set BUILD_TOOLS_PATH=%MSBUILD12_TOOLS_PATH%
26-
)
17+
if exist %BUILD_TOOLS_PATH% (
18+
goto :restore
2719
)
2820

29-
IF EXIST %CACHED_NUGET% goto restore
30-
echo Downloading latest version of NuGet.exe...
31-
IF NOT EXIST %LocalAppData%\NuGet md %LocalAppData%\NuGet
32-
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://www.nuget.org/nuget.exe' -OutFile '%CACHED_NUGET%'"
21+
:error
22+
echo In order to run this tool you need either Visual Studio 2017 Update 2 or
23+
echo Microsoft Build Tools 2017 Update 2 installed.
24+
echo.
25+
echo Visit this page to download either:
26+
echo.
27+
echo https://go.microsoft.com/fwlink/?linkid=840931
28+
echo.
29+
exit /b 2
3330

3431
:restore
35-
IF NOT EXIST src\packages md src\packages
36-
%CACHED_NUGET% restore %SOLUTION_PATH%
32+
%BUILD_TOOLS_PATH% %SOLUTION_PATH% /t:restore /nologo /m /v:m /bl:restore.binlog
3733

38-
%BUILD_TOOLS_PATH% %SOLUTION_PATH% /p:OutDir="%~dp0bin" /nologo /m /v:m /flp:verbosity=normal %*
34+
%BUILD_TOOLS_PATH% %SOLUTION_PATH% /p:OutDir="%~dp0bin" /nologo /m /v:m /bl:build.binlog %*

build.props

-30
This file was deleted.

dependencies.props

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<MSBuildPackageVersion>15.7.179</MSBuildPackageVersion>
5+
<MicrosoftCodeAnalysisPackageVersion>2.8.2</MicrosoftCodeAnalysisPackageVersion>
6+
<MicrosoftCodeAnalysisAnalyzersPackageVersion>2.6.1</MicrosoftCodeAnalysisAnalyzersPackageVersion>
7+
<XunitPackageVersion>2.4.0</XunitPackageVersion>
8+
<MicrosoftVisualStudioTestPlatformPackageVersion>14.0.0.1</MicrosoftVisualStudioTestPlatformPackageVersion>
9+
</PropertyGroup>
10+
</Project>

src/CodeFormatter.sln

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 2013
4-
VisualStudioVersion = 12.0.31101.0
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.27616.0
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.DotNet.CodeFormatting", "Microsoft.DotNet.CodeFormatting\Microsoft.DotNet.CodeFormatting.csproj", "{D535641F-A2D7-481C-930D-96C02F052B95}"
77
EndProject
88
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeFormatter", "CodeFormatter\CodeFormatter.csproj", "{B0E1A988-F762-459D-AD0D-56A3CF4FFF3F}"
99
EndProject
1010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.DotNet.CodeFormatting.Tests", "Microsoft.DotNet.CodeFormatting.Tests\Microsoft.DotNet.CodeFormatting.Tests.csproj", "{D4D6FF88-0586-43C7-BDE4-D336EB25E7AA}"
1111
EndProject
12-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{34034F12-9FB5-4154-91DA-7914B7D013BD}"
13-
ProjectSection(SolutionItems) = preProject
14-
.nuget\packages.config = .nuget\packages.config
15-
EndProjectSection
16-
EndProject
1712
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XUnitConverter", "XUnitConverter\XUnitConverter.csproj", "{81B0FF57-C128-4F6B-83C7-94DBAF261582}"
1813
EndProject
1914
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XUnitConverter.Tests", "XUnitConverter.Tests\XUnitConverter.Tests.csproj", "{BA4C1700-8A72-4F33-AF67-0E60F324E521}"
@@ -66,4 +61,7 @@ Global
6661
GlobalSection(SolutionProperties) = preSolution
6762
HideSolutionNode = FALSE
6863
EndGlobalSection
64+
GlobalSection(ExtensibilityGlobals) = postSolution
65+
SolutionGuid = {641F7536-D98F-4D5C-AF9F-1B24FC80BAED}
66+
EndGlobalSection
6967
EndGlobal

src/CodeFormatter/App.config

+1-33
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,11 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
33
<startup>
4-
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
55
</startup>
66
<runtime>
77
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
88
<probing privatePath="./msbuild" />
9-
<dependentAssembly>
10-
<assemblyIdentity name="Microsoft.CodeAnalysis" publicKeyToken="31bf3856ad364e35" culture="neutral" />
11-
<bindingRedirect oldVersion="0.0.0.0-1.0.0.0" newVersion="1.0.0.0" />
12-
</dependentAssembly>
13-
<dependentAssembly>
14-
<assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
15-
<bindingRedirect oldVersion="0.0.0.0-1.1.36.0" newVersion="1.1.36.0" />
16-
</dependentAssembly>
17-
<dependentAssembly>
18-
<assemblyIdentity name="System.Reflection.Metadata" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
19-
<bindingRedirect oldVersion="0.0.0.0-1.0.21.0" newVersion="1.0.21.0" />
20-
</dependentAssembly>
21-
<dependentAssembly>
22-
<assemblyIdentity name="Microsoft.CodeAnalysis.Desktop" publicKeyToken="31bf3856ad364e35" culture="neutral" />
23-
<bindingRedirect oldVersion="0.0.0.0-1.0.0.0" newVersion="1.0.0.0" />
24-
</dependentAssembly>
25-
<dependentAssembly>
26-
<assemblyIdentity name="Microsoft.CodeAnalysis.Workspaces" publicKeyToken="31bf3856ad364e35" culture="neutral" />
27-
<bindingRedirect oldVersion="0.0.0.0-1.0.0.0" newVersion="1.0.0.0" />
28-
</dependentAssembly>
29-
<dependentAssembly>
30-
<assemblyIdentity name="Microsoft.CodeAnalysis.CSharp.Desktop" publicKeyToken="31bf3856ad364e35" culture="neutral" />
31-
<bindingRedirect oldVersion="0.0.0.0-0.7.0.0" newVersion="0.7.0.0" />
32-
</dependentAssembly>
33-
<dependentAssembly>
34-
<assemblyIdentity name="Microsoft.CodeAnalysis.CSharp" publicKeyToken="31bf3856ad364e35" culture="neutral" />
35-
<bindingRedirect oldVersion="0.0.0.0-0.7.0.0" newVersion="0.7.0.0" />
36-
</dependentAssembly>
37-
<dependentAssembly>
38-
<assemblyIdentity name="Microsoft.CodeAnalysis.CSharp.Workspaces" publicKeyToken="31bf3856ad364e35" culture="neutral" />
39-
<bindingRedirect oldVersion="0.0.0.0-0.7.0.0" newVersion="0.7.0.0" />
40-
</dependentAssembly>
419
</assemblyBinding>
4210
</runtime>
4311
</configuration>
+3-98
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,8 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<Import Project="..\..\build.props" />
1+
<Project Sdk="Microsoft.NET.Sdk">
42
<PropertyGroup>
5-
<ProjectGuid>{B0E1A988-F762-459D-AD0D-56A3CF4FFF3F}</ProjectGuid>
63
<OutputType>Exe</OutputType>
7-
<AppDesignerFolder>Properties</AppDesignerFolder>
8-
<RootNamespace>CodeFormatter</RootNamespace>
9-
<AssemblyName>CodeFormatter</AssemblyName>
4+
<TargetFramework>net46</TargetFramework>
105
</PropertyGroup>
11-
<!-- Default configurations to help VS understand -->
12-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
13-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
14-
<ItemGroup>
15-
<Reference Include="Microsoft.CodeAnalysis, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
16-
<HintPath>..\packages\Microsoft.CodeAnalysis.Common.1.0.0\lib\net45\Microsoft.CodeAnalysis.dll</HintPath>
17-
<Private>True</Private>
18-
</Reference>
19-
<Reference Include="Microsoft.CodeAnalysis.CSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
20-
<HintPath>..\packages\Microsoft.CodeAnalysis.CSharp.1.0.0\lib\net45\Microsoft.CodeAnalysis.CSharp.dll</HintPath>
21-
<Private>True</Private>
22-
</Reference>
23-
<Reference Include="Microsoft.CodeAnalysis.CSharp.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
24-
<HintPath>..\packages\Microsoft.CodeAnalysis.CSharp.Workspaces.1.0.0\lib\net45\Microsoft.CodeAnalysis.CSharp.Workspaces.dll</HintPath>
25-
<Private>True</Private>
26-
</Reference>
27-
<Reference Include="Microsoft.CodeAnalysis.VisualBasic, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
28-
<HintPath>..\packages\Microsoft.CodeAnalysis.VisualBasic.1.0.0\lib\net45\Microsoft.CodeAnalysis.VisualBasic.dll</HintPath>
29-
<Private>True</Private>
30-
</Reference>
31-
<Reference Include="Microsoft.CodeAnalysis.VisualBasic.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
32-
<HintPath>..\packages\Microsoft.CodeAnalysis.VisualBasic.Workspaces.1.0.0\lib\net45\Microsoft.CodeAnalysis.VisualBasic.Workspaces.dll</HintPath>
33-
<Private>True</Private>
34-
</Reference>
35-
<Reference Include="Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
36-
<HintPath>..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.0.0\lib\net45\Microsoft.CodeAnalysis.Workspaces.dll</HintPath>
37-
<Private>True</Private>
38-
</Reference>
39-
<Reference Include="Microsoft.CodeAnalysis.Workspaces.Desktop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
40-
<HintPath>..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.0.0\lib\net45\Microsoft.CodeAnalysis.Workspaces.Desktop.dll</HintPath>
41-
<Private>True</Private>
42-
</Reference>
43-
<Reference Include="System" />
44-
<Reference Include="System.Collections.Immutable, Version=1.1.36.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
45-
<HintPath>..\packages\System.Collections.Immutable.1.1.36\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
46-
<Private>True</Private>
47-
</Reference>
48-
<Reference Include="System.ComponentModel.Composition" />
49-
<Reference Include="System.Composition.AttributedModel, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
50-
<SpecificVersion>False</SpecificVersion>
51-
<HintPath>..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.AttributedModel.dll</HintPath>
52-
</Reference>
53-
<Reference Include="System.Composition.Convention, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
54-
<SpecificVersion>False</SpecificVersion>
55-
<HintPath>..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Convention.dll</HintPath>
56-
</Reference>
57-
<Reference Include="System.Composition.Hosting, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
58-
<SpecificVersion>False</SpecificVersion>
59-
<HintPath>..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Hosting.dll</HintPath>
60-
</Reference>
61-
<Reference Include="System.Composition.Runtime, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
62-
<SpecificVersion>False</SpecificVersion>
63-
<HintPath>..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Runtime.dll</HintPath>
64-
</Reference>
65-
<Reference Include="System.Composition.TypedParts, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
66-
<SpecificVersion>False</SpecificVersion>
67-
<HintPath>..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.TypedParts.dll</HintPath>
68-
</Reference>
69-
<Reference Include="System.Core" />
70-
<Reference Include="System.Reflection.Metadata, Version=1.0.21.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
71-
<HintPath>..\packages\System.Reflection.Metadata.1.0.21\lib\portable-net45+win8\System.Reflection.Metadata.dll</HintPath>
72-
<Private>True</Private>
73-
</Reference>
74-
<Reference Include="System.Xml.Linq" />
75-
<Reference Include="System.Data.DataSetExtensions" />
76-
<Reference Include="Microsoft.CSharp" />
77-
<Reference Include="System.Data" />
78-
<Reference Include="System.Xml" />
79-
</ItemGroup>
80-
<ItemGroup>
81-
<Compile Include="CommandLineParser.cs" />
82-
<Compile Include="Program.cs" />
83-
<Compile Include="Properties\AssemblyInfo.cs" />
84-
</ItemGroup>
856
<ItemGroup>
867
<Content Include="CopyrightHeader.md">
878
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
@@ -91,20 +12,8 @@
9112
</Content>
9213
</ItemGroup>
9314
<ItemGroup>
94-
<None Include="App.config" />
95-
<None Include="packages.config" />
96-
</ItemGroup>
97-
<ItemGroup>
98-
<ProjectReference Include="..\Microsoft.DotNet.CodeFormatting\Microsoft.DotNet.CodeFormatting.csproj">
99-
<Project>{D535641F-A2D7-481C-930D-96C02F052B95}</Project>
100-
<Name>Microsoft.DotNet.CodeFormatting</Name>
101-
</ProjectReference>
102-
</ItemGroup>
103-
<ItemGroup>
104-
<Analyzer Include="..\packages\Microsoft.CodeAnalysis.Analyzers.1.0.0\analyzers\dotnet\cs\Microsoft.CodeAnalysis.Analyzers.dll" />
105-
<Analyzer Include="..\packages\Microsoft.CodeAnalysis.Analyzers.1.0.0\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.Analyzers.dll" />
15+
<ProjectReference Include="..\Microsoft.DotNet.CodeFormatting\Microsoft.DotNet.CodeFormatting.csproj" />
10616
</ItemGroup>
107-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
10817
<Target Name="CopyMSBuildForMono"
10918
AfterTargets="AfterBuild"
11019
Condition=" '$(OS)' == 'Unix' ">
@@ -123,8 +32,4 @@
12332
</ItemGroup>
12433
<RemoveDir Directories="@(LocalMonoMSBuild)" />
12534
</Target>
126-
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
127-
Other similar extension points exist, see Microsoft.Common.targets.
128-
<Target Name="BeforeBuild">
129-
</Target> -->
13035
</Project>

src/CodeFormatter/Program.cs

+1
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ private static int RunFormat(CommandLineOptions options)
8181
throw;
8282

8383
Console.WriteLine("ERROR: Type loading error detected. In order to run this tool you need either Visual Studio 2015 or Microsoft Build Tools 2015 tools installed.");
84+
Console.WriteLine(typeLoadException.StackTrace);
8485
var messages = typeLoadException.LoaderExceptions.Select(e => e.Message).Distinct();
8586
foreach (var message in messages)
8687
Console.WriteLine("- {0}", message);

src/CodeFormatter/Properties/AssemblyInfo.cs

-20
This file was deleted.

src/CodeFormatter/packages.config

-14
This file was deleted.

0 commit comments

Comments
 (0)