From 4fd42158b1b1458834238bf4eca3c76a7ab9b79d Mon Sep 17 00:00:00 2001 From: Martin Brown <5264795+martingbrown@users.noreply.github.com> Date: Sat, 19 Jan 2019 09:34:17 +0000 Subject: [PATCH] Upgrade to VS 2017 (#776) * Upgrades writer solution's projects to VS2017 Re-writes build script in powershell using MS Recommended techinque for finding ms-build Changes version number by one * Udated BlogRunner.sln projects to Visual Studio 2017 Also fixed invalid dll references and processor architecture * Upgraded SetupCustomCultures.sln projects to VS 2017 Upgraded the projects to use .Net Framework 4.6.1 * Updates FauxLocalizationResourceGenerator.sln projects to VS 2017 Also updates to .Net Framework 4.6.1 * Removes unwanted deploy restriction from appveyor.yml --- appveyor.yml | 2 +- build.cmd | 48 +------- build.ps1 | 109 ++++++++++++++++++ .../OpenLiveWriter.Ribbon.vcxproj | 5 +- .../BlogRunner.Core/BlogRunner.Core.csproj | 22 ++-- utilities/BlogRunner/BlogRunner.sln | 9 +- .../BlogRunner/BlogRunner/BlogRunner.csproj | 17 ++- utilities/BlogRunner/BlogRunner/app.config | 3 + .../BlogRunnerGui/BlogRunnerGui.csproj | 17 ++- .../Properties/Resources.Designer.cs | 46 +++----- .../Properties/Settings.Designer.cs | 24 ++-- utilities/BlogRunner/BlogRunnerGui/app.config | 3 + .../BlogRunnerReporter.csproj | 14 ++- .../Properties/Resources.Designer.cs | 46 +++----- .../Properties/Settings.Designer.cs | 24 ++-- .../BlogRunner/BlogRunnerReporter/app.config | 3 + .../CustomCulture/SetupCustomCultures.csproj | 36 +++++- .../CustomCulture/SetupCustomCultures.sln | 9 +- utilities/CustomCulture/app.config | 3 + .../FauxLocalizationResourceGenerator.csproj | 36 +++++- .../FauxLocalizationResourceGenerator.sln | 9 +- .../app.config | 3 + version.txt | 2 +- 23 files changed, 334 insertions(+), 156 deletions(-) create mode 100644 build.ps1 create mode 100644 utilities/BlogRunner/BlogRunner/app.config create mode 100644 utilities/BlogRunner/BlogRunnerGui/app.config create mode 100644 utilities/BlogRunner/BlogRunnerReporter/app.config create mode 100644 utilities/CustomCulture/app.config create mode 100644 utilities/FauxLocalizationResourceGenerator/app.config diff --git a/appveyor.yml b/appveyor.yml index d858f1bc..2473ce9b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -4,7 +4,7 @@ pull_requests: branches: only: - master -image: Previous Visual Studio 2015 +image: Visual Studio 2017 environment: OLW_CONFIG: Release OlwBloggerClientId: 597389294595-271ukaucs8ghmc6c6cnhrbef2c02g5qa.apps.googleusercontent.com diff --git a/build.cmd b/build.cmd index 36a17fc1..0d4debf2 100644 --- a/build.cmd +++ b/build.cmd @@ -1,47 +1 @@ -@ECHO OFF - -SETLOCAL - -SET CACHED_NUGET=%LocalAppData%\NuGet\NuGet.exe -SET SOLUTION_PATH="%~dp0src\managed\writer.sln" -SET MSBUILD14_TOOLS_PATH="%ProgramFiles(x86)%\MSBuild\14.0\bin\MSBuild.exe" -SET MSBUILD12_TOOLS_PATH="%ProgramFiles(x86)%\MSBuild\12.0\bin\MSBuild.exe" -SET BUILD_TOOLS_PATH=%MSBUILD14_TOOLS_PATH% - -IF NOT EXIST %MSBUILD14_TOOLS_PATH% ( - echo In order to run this tool you need either Visual Studio 2015 or - echo Microsoft Build Tools 2015 tools installed. - echo. - echo Visit this page to download either: - echo. - echo http://www.visualstudio.com/en-us/downloads/visual-studio-2015-downloads-vs - echo. - echo Attempting to fall back to MSBuild 12 for building only - echo. - IF NOT EXIST %MSBUILD12_TOOLS_PATH% ( - echo Could not find MSBuild 12. Please install build tools ^(See above^) - exit /b 1 - ) else ( - set BUILD_TOOLS_PATH=%MSBUILD12_TOOLS_PATH% - ) -) - -IF EXIST %CACHED_NUGET% goto restore -echo Downloading latest version of NuGet.exe... -IF NOT EXIST "%LocalAppData%\NuGet" md "%LocalAppData%\NuGet" -@powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://dist.nuget.org/win-x86-commandline/latest/nuget.exe' -OutFile '%CACHED_NUGET%'" - -:restore -IF EXIST "%~dp0src\packages" goto build -"%CACHED_NUGET%" restore %SOLUTION_PATH% - -:build - -IF "%OLW_CONFIG%" == "" ( - echo %%OLW_CONFIG%% not set, will default to 'Debug' - set OLW_CONFIG=Debug -) - -powershell.exe get-date - -%BUILD_TOOLS_PATH% %SOLUTION_PATH% /nologo /maxcpucount /verbosity:minimal /p:Configuration=%OLW_CONFIG% %* +powershell .\build.ps1 \ No newline at end of file diff --git a/build.ps1 b/build.ps1 new file mode 100644 index 00000000..ea5f334e --- /dev/null +++ b/build.ps1 @@ -0,0 +1,109 @@ +# Cause powershell to fail on errors rather than keep going +$ErrorActionPreference = "Stop"; + +@" + +======================================================= + Checking solution exists +======================================================= +"@ + +$solutionFile = "$PSSCRIPTROOT\src\managed\writer.sln" +if (-Not (Test-Path "$solutionFile" -PathType Leaf)) +{ + "Unable to find solution file at $solutionFile" + exit 100 +} +"Solution found at '$solutionFile'" + +@" + +======================================================= + Fetching MSBuild location +======================================================= +"@ + +# Install module to allow us to find MSBuild +# See https://github.com/Microsoft/vssetup.powershell +Install-Module VSSetup -Scope CurrentUser + +$visualStudioLocation = (Get-VSSetupInstance ` + | Select-VSSetupInstance -Version '[15.0,16.0)' -Latest).InstallationPath + +$msBuildExe = $visualStudioLocation + "\MSBuild\15.0\Bin\msbuild.exe" +IF (-Not (Test-Path -LiteralPath "$msBuildExe" -PathType Leaf)) +{ + "MSBuild not found at '$msBuildExe'" + "In order to build OpenLiveWriter either Visual Studio 2017 (any edition) or Build " + "Tools for Visual Studio 2017 must be installed." + "These can be downloadd from https://visualstudio.microsoft.com/downloads/" + exit 101 +} + +"MSBuild.exe found at: '$msBuildExe'" + +@" + +======================================================= + Ensureing nuget.exe exists +======================================================= +"@ + +$nugetPath = "$env:LocalAppData\NuGet" +$nugetExe = "$nugetPath\NuGet.exe" +if (-Not (Test-Path -LiteralPath "$nugetExe" -PathType Leaf)) +{ + if (-Not (Test-Path -LiteralPath "$nugetPath" -PathType Container)) + { + "Creating Directory '$nugetPath'" + New-Item "$nugetPath" -Type Directory + } + "Downloading nuget.exe" + Invoke-WebRequest 'https://dist.nuget.org/win-x86-commandline/latest/nuget.exe' -OutFile "$nugetExe" +} + +"Nuget.exe found at: '$nugetExe'" + +@" + +======================================================= + Ensure nuget packages exist +======================================================= +"@ + +$packageFolder = "$PSSCRIPTROOT\src\managed\packages" +if (Test-Path -LiteralPath $packageFolder) +{ + "Packages found at '$packageFolder'" +} +else +{ + "Running nuget restore" + & $nugetExe restore $solutionFile +} + +@" + +======================================================= + Check build type +======================================================= +"@ + +if (-Not (Test-Path env:OLW_CONFIG)) +{ + "Environment variable OWL_CONFIG not set, setting to 'Debug'" + $env:OLW_CONFIG = 'Debug' +} + +"Using build '$env:OLW_CONFIG'" + +@" + +======================================================= + Starting build +======================================================= +"@ +Get-Date +$buildCommand = "`"$msBuildExe`" $solutionFile /nologo /maxcpucount /verbosity:minimal /p:Configuration=$env:OLW_CONFIG $ARGS" +"Running build command '$buildCommand'" +Invoke-Expression "& $buildCommand" \ No newline at end of file diff --git a/src/unmanaged/OpenLiveWriter.Ribbon/OpenLiveWriter.Ribbon.vcxproj b/src/unmanaged/OpenLiveWriter.Ribbon/OpenLiveWriter.Ribbon.vcxproj index 45f69831..315bd0a2 100644 --- a/src/unmanaged/OpenLiveWriter.Ribbon/OpenLiveWriter.Ribbon.vcxproj +++ b/src/unmanaged/OpenLiveWriter.Ribbon/OpenLiveWriter.Ribbon.vcxproj @@ -15,18 +15,19 @@ {195A60BF-7A4D-42E6-B5F4-FEBC679E19F0} Win32Proj OpenLiveWriter.Ribbon + 10.0.17134.0 DynamicLibrary true - v140 + v141 Unicode DynamicLibrary false - v140 + v141 true Unicode diff --git a/utilities/BlogRunner/BlogRunner.Core/BlogRunner.Core.csproj b/utilities/BlogRunner/BlogRunner.Core/BlogRunner.Core.csproj index d714c069..7253f667 100644 --- a/utilities/BlogRunner/BlogRunner.Core/BlogRunner.Core.csproj +++ b/utilities/BlogRunner/BlogRunner.Core/BlogRunner.Core.csproj @@ -1,5 +1,5 @@  - + Debug AnyCPU @@ -10,8 +10,14 @@ Properties BlogRunner.Core BlogRunner.Core - v2.0 + v4.6.1 512 + + + + + 3.5 + true @@ -21,6 +27,7 @@ DEBUG;TRACE prompt 4 + false pdbonly @@ -29,6 +36,7 @@ TRACE prompt 4 + false @@ -36,23 +44,23 @@ False - ..\..\..\src\OpenLiveWriter.BlogClient\bin\Debug\OpenLiveWriter.BlogClient.dll + ..\..\..\src\managed\bin\Debug\i386\Writer\OpenLiveWriter.BlogClient.dll False - ..\..\..\src\OpenLiveWriter.CoreServices\bin\Debug\OpenLiveWriter.CoreServices.dll + ..\..\..\src\managed\bin\Debug\i386\Writer\OpenLiveWriter.CoreServices.dll False - ..\..\..\src\OpenLiveWriter.Extensibility\bin\Debug\OpenLiveWriter.Extensibility.dll + ..\..\..\src\managed\bin\Debug\i386\Writer\OpenLiveWriter.Extensibility.dll False - ..\..\..\src\OpenLiveWriter.HtmlParser\bin\Debug\OpenLiveWriter.HtmlParser.dll + ..\..\..\src\managed\bin\Debug\i386\Writer\OpenLiveWriter.HtmlParser.dll False - ..\..\..\src\OpenLiveWriter.PostEditor\bin\Debug\OpenLiveWriter.PostEditor.dll + ..\..\..\src\managed\bin\Debug\i386\Writer\OpenLiveWriter.PostEditor.dll diff --git a/utilities/BlogRunner/BlogRunner.sln b/utilities/BlogRunner/BlogRunner.sln index a0becf30..51065bc3 100644 --- a/utilities/BlogRunner/BlogRunner.sln +++ b/utilities/BlogRunner/BlogRunner.sln @@ -1,6 +1,8 @@  -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28010.2048 +MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlogRunner.Core", "BlogRunner.Core\BlogRunner.Core.csproj", "{1F76020F-DBB5-4F43-B530-C85EF9461A61}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlogRunner", "BlogRunner\BlogRunner.csproj", "{57644357-B52B-4C64-ACEA-89E7831EF479}" @@ -35,4 +37,7 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {336B01DD-464D-43AC-A2B6-C07D1B1A9349} + EndGlobalSection EndGlobal diff --git a/utilities/BlogRunner/BlogRunner/BlogRunner.csproj b/utilities/BlogRunner/BlogRunner/BlogRunner.csproj index 27712a71..3fd3efb0 100644 --- a/utilities/BlogRunner/BlogRunner/BlogRunner.csproj +++ b/utilities/BlogRunner/BlogRunner/BlogRunner.csproj @@ -1,5 +1,5 @@  - + Debug AnyCPU @@ -10,8 +10,14 @@ Properties BlogRunner BlogRunner - v2.0 + v4.6.1 512 + + + + + 3.5 + true @@ -21,6 +27,7 @@ DEBUG;TRACE prompt 4 + false pdbonly @@ -29,6 +36,7 @@ TRACE prompt 4 + false @@ -36,7 +44,7 @@ False - ..\..\..\src\OpenLiveWriter.CoreServices\bin\Debug\OpenLiveWriter.CoreServices.dll + ..\..\..\src\managed\bin\Debug\i386\Writer\OpenLiveWriter.CoreServices.dll @@ -49,6 +57,9 @@ BlogRunner.Core + + +