diff --git a/src/BUILD.cmd b/src/BUILD.cmd new file mode 100644 index 0000000..70c2624 --- /dev/null +++ b/src/BUILD.cmd @@ -0,0 +1,47 @@ +@echo off + +WHERE msbuild >NUL 2>NUL +IF ERRORLEVEL 1 goto :setup +goto :powershell + +:setup +if "%VS140COMNTOOLS%" NEQ "" ( + call "%VS140COMNTOOLS%vsvars32.bat" + goto :powershell +) +if "%VS150COMNTOOLS%" NEQ "" ( + call "%VS150COMNTOOLS%VsDevCmd.bat" + goto :powershell +) +if "%VS160COMNTOOLS%" NEQ "" ( + call "%VS160COMNTOOLS%VsDevCmd.bat" + goto :powershell +) else ( + echo "Run this script from the Visual Studio Developer Command Prompt" + exit /B 1 +) + +:powershell +WHERE pwsh >NUL 2>NUL +IF ERRORLEVEL 1 ( + echo "Installing 'pwsh' (PowerShell Core)" + dotnet tool install --global powershell +) + +pwsh -f Common/fix_versions.ps1 + +REM Restore NuGet packages: +msbuild -t:restore XmlDiff.sln /verbosity:minimal /p:Configuration=Release "/p:Platform=Any CPU" +if ERRORLEVEL 1 exit /B 1 + +REM Build XmlDiff: +msbuild XmlDiff.sln /verbosity:minimal /p:Configuration=Release "/p:Platform=Any CPU" +if ERRORLEVEL 1 exit /B 1 + +if "%MyKeyFile%" == "" goto :eof + +REM sign assemblies +pwsh -f Common\full_sign.ps1 + +REM create .nupkg +nuget pack XmlDiffView\XmlDiff.nuspec diff --git a/src/Common/fix_versions.ps1 b/src/Common/fix_versions.ps1 new file mode 100644 index 0000000..4fd606c --- /dev/null +++ b/src/Common/fix_versions.ps1 @@ -0,0 +1,70 @@ +$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path +$RootDir = Split-Path -Parent $ScriptDir +Set-Location $RootDir + +$props = Join-Path -Path $RootDir -ChildPath "Common\version.props" +$nuspec = Join-Path -Path $RootDir -ChildPath "XmlDiffView\XmlDiff.nuspec" + +function UpdateVersion($line) +{ + if ($line -match "\w*\([^\<]*)\") { + # this is the SgmlReader.nuspec + return $line.Replace($Matches.1, "$version") + } + elseif ($line -match "\w*\([^\<]*)\") { + # this is in version.props. + return $line.Replace($Matches.1, "$version") + } + elseif ($line -match "\w*\([^\<]*)\") { + # this is in version.props. + return $line.Replace($Matches.1, "$version") + } + elseif ($line -match "\w*\([^\<]*)\") { + # this is in version.props. + return $line.Replace($Matches.1, "$version") + } + elseif ($line -match "\w*\[assembly\: AssemblyVersion\(\`"([^<]*)\`"\)\]") { + return $line.Replace($Matches.1, "$version") + } + elseif ($line -match "\w*\[assembly\: AssemblyFileVersion\(\`"([^<]*)\`"\)\]") { + return $line.Replace($Matches.1, "$version") + } + return $line +} + +function FixFile($filename) +{ + if ($filename -eq "") { + Write-Error "Missing filename parameter" + Exit 1 + } + + $nl = [Environment]::NewLine + $versionFile = Join-Path -Path $ScriptDir -ChildPath "version.txt" + $version = Get-Content -Path $versionFile | Join-String -Separator $nl + $version = $version.Trim() + + $fullPath = $filename + if (-Not (Test-Path $fullPath)) { + $x = Get-Location + $fullPath = Join-Path -Path $x -ChildPath $filename + } + + $localcontent = Get-Content -Path $fullPath | ForEach { UpdateVersion $_ } | Join-String -Separator $nl + $encoding = New-Object System.Text.UTF8Encoding $False + + $write = $false + while (-not $write) { + try { + Write-Host "updating version in $filename" + [IO.File]::WriteAllText($filename, $localcontent, $encoding) + $write = $true + } catch { + Write-Host "file locked, trying again in 1 second: $filename" + Start-Sleep -s 1 + } + } +} + +FixFile($props) +FixFile($nuspec) \ No newline at end of file diff --git a/src/Common/full_sign.ps1 b/src/Common/full_sign.ps1 new file mode 100644 index 0000000..30d78bf --- /dev/null +++ b/src/Common/full_sign.ps1 @@ -0,0 +1,21 @@ +# This script performs the full signing of all the assemblies used in the .nuspec after the build does delay signing +$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path + +$testpath = $ScriptDir + "\..\XmlDiff\bin\Release\net46\XmlDiffPatch.dll" +if (-not (Test-Path -Path $testpath)){ + Write-Host "Please build release build of XmlDiff.sln" + exit 1 +} + +$doc = [System.Xml.Linq.XDocument]::Load("$ScriptDir\..\XmlDiffView\XmlDiff.nuspec") +$ns = $doc.Root.Name.Namespace.NamespaceName +foreach ($e in $doc.Root.Descendants()) { + if ($e.Name.LocalName -eq "file") { + $src = $e.Attribute("src").Value + if ($src.EndsWith(".dll") -or $src.EndsWith(".exe")) { + Write-Host "signing $src" + $path = $ScriptDir + "\..\XmlDiffView\" + $src + signtool sign /a /i "Sectigo Public Code Signing CA R36" /t http://timestamp.sectigo.com /fd sha256 $path + } + } +} diff --git a/src/Common/version.props b/src/Common/version.props new file mode 100644 index 0000000..04d332c --- /dev/null +++ b/src/Common/version.props @@ -0,0 +1,9 @@ + + + Lovett Software + Copyright © Lovett Software + 1.0.5 + 1.0.5 + 1.0.5 + + \ No newline at end of file diff --git a/src/Common/version.txt b/src/Common/version.txt new file mode 100644 index 0000000..1464c52 --- /dev/null +++ b/src/Common/version.txt @@ -0,0 +1 @@ +1.0.5 \ No newline at end of file diff --git a/src/XmlDiff.sln b/src/XmlDiff.sln index 245ae60..36b4849 100644 --- a/src/XmlDiff.sln +++ b/src/XmlDiff.sln @@ -1,13 +1,18 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30114.105 +# Visual Studio Version 17 +VisualStudioVersion = 17.5.33530.505 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XmlDiff", "XmlDiff\XmlDiff.csproj", "{F4B9C469-315F-47DB-90DB-D0E21170C35B}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XmlDiffView", "XmlDiffView\XmlDiffView.csproj", "{E7D8D590-B1B7-4D67-91EE-79A5DD569802}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTests", "UnitTests\UnitTests.csproj", "{D2FBED29-536D-4FA9-94F4-EB72BF89A900}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTests", "UnitTests\UnitTests.csproj", "{D2FBED29-536D-4FA9-94F4-EB72BF89A900}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{A880F19D-4487-4DD8-A987-1FD87FB7E15F}" + ProjectSection(SolutionItems) = preProject + Common\version.props = Common\version.props + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/src/XmlDiff/XmlDiff.csproj b/src/XmlDiff/XmlDiff.csproj index a1220db..37cd754 100644 --- a/src/XmlDiff/XmlDiff.csproj +++ b/src/XmlDiff/XmlDiff.csproj @@ -1,11 +1,10 @@ + netstandard2.1;netstandard2.0;net452;net46;net47;net48;netcoreapp3.1;net6.0 MEASURE_PERF;TRACE;DESCRIPTORS;DESCRIPTOR_MOVE;DESCRIPTOR_PREFIX_OR_NAMESPACE;VERIFY_HASH_VALUES XmlDiffPatch - Copyright © Microsoft - Microsoft Corporation Chris Lovett XmlDiffPatch 1.0 MIT @@ -15,22 +14,14 @@ xml;xml notepad;xmldiff XmlDiffPatch Microsoft.XmlDiffPatch - $(MyKeyFile) - true + false false A library that compares XML files - 1.0.4 $(ProjectDir)\XmlDiffPatch.xml - - $(MyKeyFile) - true - true - http://timestamp.sectigo.com - True diff --git a/src/XmlDiffView/XmlDiff.nuspec b/src/XmlDiffView/XmlDiff.nuspec index 0038c5d..1332237 100644 --- a/src/XmlDiffView/XmlDiff.nuspec +++ b/src/XmlDiffView/XmlDiff.nuspec @@ -2,7 +2,7 @@ LovettSoftware.XmlDiff - 1.0.4 + 1.0.5 Chris Lovett A library that compares and merges XML files. https://github.com/lovettchris/xmldiff @@ -40,7 +40,7 @@ - + diff --git a/src/XmlDiffView/XmlDiffView.csproj b/src/XmlDiffView/XmlDiffView.csproj index 0b27a48..df1c0e3 100644 --- a/src/XmlDiffView/XmlDiffView.csproj +++ b/src/XmlDiffView/XmlDiffView.csproj @@ -1,10 +1,9 @@ + netstandard2.0;netstandard2.1;net452;net46;net47;net48;netcoreapp3.1;net6.0 XmlDiffView - Copyright © Microsoft - Lovett Software Chris Lovett XmlDiffView 1.0 MIT @@ -14,22 +13,14 @@ xml;xmldiff XmlDiffPatch.View Microsoft.XmlDiffPatch.View - $(MyKeyFile) - true + false Displays the results of an XML file comparison false - 1.0.4 $(ProjectDir)\XmlDiffPatch.View.xml - - $(MyKeyFile) - true - true - http://timestamp.sectigo.com -