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

Commit 2aab0f8

Browse files
committed
Update all projects to use SDK-style projects
This updates all projects to use the Microsoft.NET.Sdk and PackageReference. This requires MSBuild 15 (VS 2017) so the build script has been updated to locate this.
1 parent ea592c2 commit 2aab0f8

39 files changed

+82
-1399
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ bld/
2020
[Bb]in/
2121
[Oo]bj/
2222
msbuild.log
23+
*.binlog
2324

2425
# Roslyn stuff
2526
*.sln.ide

Directory.Build.props

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
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+
<TargetFramework Condition="'$(TargetFramework)' == ''">net46</TargetFramework>
7+
<Authors Condition="'$(Authors)' == ''">Microsoft Corporation</Authors>
8+
</PropertyGroup>
9+
</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

+23-26
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,32 @@ 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 -products * -requires Microsoft.Component.MSBuild -property installationPath`) do (
14+
set _vsDir=%%i
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 "%_vsDir%\MSBuild\15.0\Bin\MSBuild.exe" (
18+
set BUILD_TOOLS_PATH="%_vsDir%\MSBuild\15.0\Bin\MSBuild.exe"
19+
goto :restore
2720
)
2821

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%'"
22+
:error
23+
echo In order to run this tool you need either Visual Studio 2017 Update 2 or
24+
echo Microsoft Build Tools 2017 Update 2 installed.
25+
echo.
26+
echo Visit this page to download either:
27+
echo.
28+
echo https://go.microsoft.com/fwlink/?linkid=840931
29+
echo.
30+
exit /b 2
3331

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

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

build.props

-30
This file was deleted.

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>
+2-98
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,7 @@
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>
104
</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>
855
<ItemGroup>
866
<Content Include="CopyrightHeader.md">
877
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
@@ -91,20 +11,8 @@
9111
</Content>
9212
</ItemGroup>
9313
<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" />
14+
<ProjectReference Include="..\Microsoft.DotNet.CodeFormatting\Microsoft.DotNet.CodeFormatting.csproj" />
10615
</ItemGroup>
107-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
10816
<Target Name="CopyMSBuildForMono"
10917
AfterTargets="AfterBuild"
11018
Condition=" '$(OS)' == 'Unix' ">
@@ -123,8 +31,4 @@
12331
</ItemGroup>
12432
<RemoveDir Directories="@(LocalMonoMSBuild)" />
12533
</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> -->
13034
</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.

src/DeadRegions/App.config

-42
This file was deleted.

0 commit comments

Comments
 (0)