diff --git a/Build/UnitsNet.Serialization.JsonNet.nuspec b/Build/UnitsNet.Serialization.JsonNet.nuspec
index a427d98a75..331d095aa0 100644
--- a/Build/UnitsNet.Serialization.JsonNet.nuspec
+++ b/Build/UnitsNet.Serialization.JsonNet.nuspec
@@ -23,7 +23,7 @@
-
+
diff --git a/Build/UnitsNet.Signed.nuspec b/Build/UnitsNet.Signed.nuspec
new file mode 100644
index 0000000000..04171d34c3
--- /dev/null
+++ b/Build/UnitsNet.Signed.nuspec
@@ -0,0 +1,25 @@
+
+
+
+ UnitsNet.Signed
+ 3.48.1
+ Units.NET (signed)
+ Andreas Gullberg Larsen
+ Andreas Gullberg Larsen
+ https://github.com/anjdreas/UnitsNet/blob/master/LICENSE
+ https://github.com/anjdreas/UnitsNet
+ false
+ Strong name signed edition of Units.NET. Only use this if you need a signed version.
+ Strong name signed edition of Units.NET.
+ https://raw.githubusercontent.com/anjdreas/UnitsNet/ce85185429be345d77eb2ce09c99d59cc9ab8aed/Docs/Images/logo-32.png
+
+
+ Copyright © 2015 Andreas Gullberg Larsen
+ en-US
+ unit units measurement si metric imperial abbreviation abbreviations convert conversion parse c# .net immutable
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Build/UnitsNet.WindowsRuntimeComponent.nuspec b/Build/UnitsNet.WindowsRuntimeComponent.nuspec
index c7acd7c7b2..c9bd48dd2a 100644
--- a/Build/UnitsNet.WindowsRuntimeComponent.nuspec
+++ b/Build/UnitsNet.WindowsRuntimeComponent.nuspec
@@ -19,7 +19,7 @@
unit units measurement si metric imperial abbreviation abbreviations convert conversion parse c# .net immutable uwp uap winrt win10 windows runtime component
-
+
\ No newline at end of file
diff --git a/Build/UnitsNet.nuspec b/Build/UnitsNet.nuspec
index d4efbf0143..c2f5591c58 100644
--- a/Build/UnitsNet.nuspec
+++ b/Build/UnitsNet.nuspec
@@ -19,7 +19,7 @@
unit units measurement si metric imperial abbreviation abbreviations convert conversion parse c# .net immutable
-
+
\ No newline at end of file
diff --git a/Build/build-all-debug.bat b/Build/build-all-debug.bat
index b7b01c203f..08ce6be582 100644
--- a/Build/build-all-debug.bat
+++ b/Build/build-all-debug.bat
@@ -1,3 +1,13 @@
-SET ROOT=%~dp0..
-"C:\Program Files (x86)\MSBuild\14.0\Bin\MsBuild.exe" %ROOT%\Build\all.msbuild /verbosity:normal /p:Configuration=Debug /p:Platform="AnyCPU" /target:CleanAndBuild /p:RestorePackages=false
+@echo off
+set ROOT=%~dp0..
+set SrcDir="%ROOT%\Artifacts\Bin\Src"
+set SrcUnsignedDir="%ROOT%\Artifacts\Bin\Src-unsigned"
+
+echo Build unsigned binaries.
+"C:\Program Files (x86)\MSBuild\14.0\Bin\MsBuild.exe" %ROOT%\Build\build-all.msbuild /verbosity:normal /p:Configuration=Debug /target:Clean;Rebuild /p:RestorePackages=false
if %errorlevel% neq 0 exit /b %errorlevel%
+
+echo Move unsigned binaries to: %SrcUnsignedDir%
+if exist %SrcUnsignedDir% rmdir /Q /S %SrcUnsignedDir%
+ren %SrcDir% "Src-unsigned"
+if %errorlevel% neq 0 exit /b %errorlevel%
\ No newline at end of file
diff --git a/Build/build-all-release.bat b/Build/build-all-release.bat
index 98172cc3a1..89cf202add 100644
--- a/Build/build-all-release.bat
+++ b/Build/build-all-release.bat
@@ -1,4 +1,13 @@
@echo off
-SET ROOT=%~dp0..
-"C:\Program Files (x86)\MSBuild\14.0\Bin\MsBuild.exe" %ROOT%\Build\all.msbuild /verbosity:normal /p:Configuration=Release /p:Platform="AnyCPU" /target:CleanAndBuild /p:RestorePackages=false
+set ROOT=%~dp0..
+set SrcDir="%ROOT%\Artifacts\Bin\Src"
+set SrcUnsignedDir="%ROOT%\Artifacts\Bin\Src-unsigned"
+
+echo Build unsigned binaries.
+"C:\Program Files (x86)\MSBuild\14.0\Bin\MsBuild.exe" %ROOT%\Build\build-all.msbuild /verbosity:normal /p:Configuration=Release /target:Clean;Rebuild /p:RestorePackages=false
if %errorlevel% neq 0 exit /b %errorlevel%
+
+echo Move unsigned binaries to: %SrcUnsignedDir%
+if exist %SrcUnsignedDir% rmdir /Q /S %SrcUnsignedDir%
+ren %SrcDir% "Src-unsigned"
+if %errorlevel% neq 0 exit /b %errorlevel%
\ No newline at end of file
diff --git a/Build/all.msbuild b/Build/build-all.msbuild
similarity index 65%
rename from Build/all.msbuild
rename to Build/build-all.msbuild
index 10cd4fec26..61a07a813f 100644
--- a/Build/all.msbuild
+++ b/Build/build-all.msbuild
@@ -6,17 +6,7 @@
Release
14.0
$(MSBuildProjectDirectory)\..\
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
- Properties="Platform=$(Platform);Configuration=$(Configuration);VisualStudioVersion=$(VisualStudioVersion)"
- Targets="Build">
-
+
+
-
+
\ No newline at end of file
diff --git a/Build/build-signed-release.bat b/Build/build-signed-release.bat
new file mode 100644
index 0000000000..b474902ec2
--- /dev/null
+++ b/Build/build-signed-release.bat
@@ -0,0 +1,25 @@
+@echo off
+set StrongNameSignFile="%1"
+set errorlevel=0
+set ROOT=%~dp0..
+set SrcDir="%ROOT%\Artifacts\Bin\Src"
+set SrcSignedDir="%ROOT%\Artifacts\Bin\Src-signed"
+
+if exist "%StrongNameSignFile%" (
+ echo Build signed binaries with key: %StrongNameSignFile%
+ "C:\Program Files (x86)\MSBuild\14.0\Bin\MsBuild.exe" %ROOT%\Build\build-signed.msbuild /verbosity:Normal /p:Configuration=Release /target:Clean;Rebuild /p:RestorePackages=false /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=%StrongNameSignFile%
+
+ if %errorlevel% neq 0 (
+ echo Error: %errorlevel%
+ exit /b %errorlevel%
+ )
+
+ echo %SrcDir%
+ echo Move signed binaries to: %SrcSignedDir%
+ @echo on
+ if exist %SrcSignedDir% rmdir /Q /S %SrcSignedDir%
+ ren %SrcDir% "Src-signed"
+ @echo off
+) else (
+ echo NO STRONG NAME SIGNING FILE: %StrongNameSignFile%
+)
\ No newline at end of file
diff --git a/Build/build-signed.msbuild b/Build/build-signed.msbuild
new file mode 100644
index 0000000000..9fa2e81a6f
--- /dev/null
+++ b/Build/build-signed.msbuild
@@ -0,0 +1,39 @@
+
+
+
+
+ AnyCPU
+ Release
+ 14.0
+ $(MSBuildProjectDirectory)\..\
+
+ $(RootPath)\UnitsNet\UnitsNet.Net35.csproj;
+ $(RootPath)\UnitsNet\UnitsNet.Portable40.csproj;
+ $(RootPath)\UnitsNet\UnitsNet.NetStandard10.csproj;
+ $(RootPath)\UnitsNet\UnitsNet.WindowsRuntimeComponent.csproj;
+ $(RootPath)\UnitsNet.Serialization.JsonNet\UnitsNet.Serialization.JsonNet.Net35.csproj
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Build/build.bat b/Build/build.bat
index 869aec3779..2a453a982f 100644
--- a/Build/build.bat
+++ b/Build/build.bat
@@ -1,22 +1,53 @@
@echo off
-SET ROOT=%~dp0..
+rem This file builds everything and is run on the build server as part of
+rem building, testing and packing nugets for all master commits and pull requests.
+
+rem Publishing nugets is handled by nuget-publish.bat and run by the build server
+rem on the master branch.
+
+rem Optional strong name signing .pfx key file to produce signed binaries and nugets.
+set StrongNameSignFile="%1"
+
+set ROOT=%~dp0..
+
+if exist %StrongNameSignFile% (
+ echo Using strong name signing key file: %StrongNameSignFile%
+) else (
+ echo No strong name signing key file specified. Will only build unsigned binaries and nugets.
+)
if exist %ROOT%\Artifacts rmdir /Q /S %ROOT%\Artifacts
+rem Regenerate all source code and test stubs before building
+rem since there is no guarantee that merged pull requests
+rem have properly regenerated code.
+call %ROOT%\GenerateUnits.bat
+if %errorlevel% neq 0 exit /b %errorlevel%
+
+rem Update AsseemblyInfo.cs versions from .nuspec files
call powershell -NoProfile %ROOT%\Build\UpdateAssemblyInfo.ps1
if %errorlevel% neq 0 exit /b %errorlevel%
+rem Restore nugets
call %ROOT%\Build\nuget-restore.bat
if %errorlevel% neq 0 exit /b %errorlevel%
+rem Build source and tests
call %ROOT%\Build\build-all-release.bat
if %errorlevel% neq 0 exit /b %errorlevel%
+rem Run all tests
call %ROOT%\Build\run-tests.bat
if %errorlevel% neq 0 exit /b %errorlevel%
+rem Only build signed binaries if tests pass
+call %ROOT%\Build\build-signed-release.bat %StrongNameSignFile%
+if %errorlevel% neq 0 exit /b %errorlevel%
+
+rem Pack nugets for both signed and unsigned binaries
call %ROOT%\Build\pack-nuget.bat
if %errorlevel% neq 0 exit /b %errorlevel%
+rem Create a zip bundle of everything, becomes available in TeamCity for download
call %ROOT%\Build\zip-artifacts.bat
if %errorlevel% neq 0 exit /b %errorlevel%
\ No newline at end of file
diff --git a/Build/msbuild-signed.msbuild b/Build/msbuild-signed.msbuild
new file mode 100644
index 0000000000..c016436f1e
--- /dev/null
+++ b/Build/msbuild-signed.msbuild
@@ -0,0 +1,26 @@
+
+
+
+
+ AnyCPU
+ Release
+ 14.0
+ $(MSBuildProjectDirectory)\..\
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Build/pack-nuget.bat b/Build/pack-nuget.bat
index 4a1926a869..e952523246 100644
--- a/Build/pack-nuget.bat
+++ b/Build/pack-nuget.bat
@@ -1,6 +1,7 @@
@echo off
SET ROOT=%~dp0..
SET MainNuspec=%ROOT%\Build\UnitsNet.nuspec
+SET MainSignedNuspec=%ROOT%\Build\UnitsNet.Signed.nuspec
SET UwpNuspec=%ROOT%\Build\UnitsNet.WindowsRuntimeComponent.nuspec
SET SerializationNuspec=%ROOT%\Build\UnitsNet.Serialization.JsonNet.nuspec
SET NuGetExe=%ROOT%\Tools\NuGet.exe
@@ -10,7 +11,12 @@ mkdir "%NuGetOutDir%"
%NuGetExe% pack %MainNuspec% -Verbosity detailed -OutputDirectory "%NuGetOutDir%" -BasePath "%ROOT%" -Symbols
if %errorlevel% neq 0 exit /b %errorlevel%
+
+%NuGetExe% pack %MainSignedNuspec% -Verbosity detailed -OutputDirectory "%NuGetOutDir%" -BasePath "%ROOT%" -Symbols
+if %errorlevel% neq 0 exit /b %errorlevel%
+
%NuGetExe% pack %UwpNuspec% -Verbosity detailed -OutputDirectory "%NuGetOutDir%" -BasePath "%ROOT%" -Symbols
if %errorlevel% neq 0 exit /b %errorlevel%
+
%NuGetExe% pack %SerializationNuspec% -Verbosity detailed -OutputDirectory "%NuGetOutDir%" -BasePath "%ROOT%" -Symbols
if %errorlevel% neq 0 exit /b %errorlevel%
diff --git a/GenerateUnits.bat b/GenerateUnits.bat
index 0b52484ae7..6be05df836 100644
--- a/GenerateUnits.bat
+++ b/GenerateUnits.bat
@@ -1,4 +1,3 @@
@echo off
SET scriptdir=%~dp0
powershell -ExecutionPolicy Bypass -NoProfile -File %scriptdir%UnitsNet\Scripts\GenerateUnits.ps1
-pause
diff --git a/UnitsNet.Tests/CustomCode/ForceTests.cs b/UnitsNet.Tests/CustomCode/ForceTests.cs
index aed947e846..490efece03 100644
--- a/UnitsNet.Tests/CustomCode/ForceTests.cs
+++ b/UnitsNet.Tests/CustomCode/ForceTests.cs
@@ -27,11 +27,11 @@ public class ForceTests : ForceTestsBase
{
protected override double DyneInOneNewton => 1E5;
- protected override double KilogramsForceInOneNewton => 1/Constants.Gravity;
+ protected override double KilogramsForceInOneNewton => 0.101972;
protected override double KilonewtonsInOneNewton => 1E-3;
- protected override double KiloPondsInOneNewton => 1/Constants.Gravity;
+ protected override double KiloPondsInOneNewton => 0.101972;
protected override double NewtonsInOneNewton => 1;
diff --git a/UnitsNet.Tests/UnitSystemTests.cs b/UnitsNet.Tests/UnitSystemTests.cs
index 547f4f225e..e2b646b196 100644
--- a/UnitsNet.Tests/UnitSystemTests.cs
+++ b/UnitsNet.Tests/UnitSystemTests.cs
@@ -83,8 +83,8 @@ private enum CustomUnit
private UnitSystem GetCachedUnitSystem()
{
- CultureInfo cultureInfo = CultureInfo.GetCultureInfo("en-US");
- UnitSystem unitSystem = UnitSystem.GetCached(cultureInfo);
+ Culture culture = GetCulture("en-US");
+ UnitSystem unitSystem = UnitSystem.GetCached(culture);
return unitSystem;
}
@@ -92,14 +92,18 @@ private static IEnumerable