diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f24569f..fd6a3ce 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,4 +9,4 @@ build: - docker script: - bash build.sh - - dotnet nuget push -k $APIKEY -s https://nuget.am-wd.de/v3/index.json --skip-duplicate build/*.nupkg + - dotnet nuget push -k $APIKEY -s https://nuget.am-wd.de/v3/index.json --skip-duplicate artifacts/*.nupkg diff --git a/AMWD.Common/Extensions/StringExtensions.cs b/AMWD.Common/Extensions/StringExtensions.cs index c5f012b..f5419ce 100644 --- a/AMWD.Common/Extensions/StringExtensions.cs +++ b/AMWD.Common/Extensions/StringExtensions.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Globalization; using System.Linq; using System.Text; @@ -117,5 +118,20 @@ namespace System return str; } + + /// + /// Parses a to a using culture "de" or invariant. + /// + /// The string to parse. + /// + public static decimal ParseDecimal(this string decString) + { + int dotIndex = decString.LastIndexOf('.'); + int commaIndex = decString.LastIndexOf(','); + + var culture = dotIndex < commaIndex ? new CultureInfo("de-DE") : CultureInfo.InvariantCulture; + + return decimal.Parse(decString, culture); + } } } diff --git a/build.bat b/build.bat deleted file mode 100644 index 60e9765..0000000 --- a/build.bat +++ /dev/null @@ -1,30 +0,0 @@ -@echo off -set Configuration=Release - -cd "%~dp0" -cd "AMWD.Common" -rmdir /S /Q bin -dotnet build -c %Configuration% --nologo --no-incremental - -cd "%~dp0" -cd "AMWD.Common.AspNetCore" -rmdir /S /Q bin -dotnet build -c %Configuration% --nologo --no-incremental - -cd "%~dp0" -cd "AMWD.Common.EntityFrameworkCore" -rmdir /S /Q bin -dotnet build -c %Configuration% --nologo --no-incremental - -cd "%~dp0" -rmdir /S /Q build -mkdir build - -move AMWD.Common\bin\%Configuration%\*.nupkg build -move AMWD.Common\bin\%Configuration%\*.snupkg build - -move AMWD.Common.AspNetCore\bin\%Configuration%\*.nupkg build -move AMWD.Common.AspNetCore\bin\%Configuration%\*.snupkg build - -move AMWD.Common.EntityFrameworkCore\bin\%Configuration%\*.nupkg build -move AMWD.Common.EntityFrameworkCore\bin\%Configuration%\*.snupkg build diff --git a/build.cmd b/build.cmd new file mode 100644 index 0000000..38adee8 --- /dev/null +++ b/build.cmd @@ -0,0 +1,42 @@ +@echo off +set Configuration=Release + +cd "%~dp0" +powershell write-host -fore Blue Restoring solution + +rmdir /S /Q artifacts +mkdir artifacts + +dotnet restore -v q +:: dotnet tool restore -v q + +cd "%~dp0" +cd "AMWD.Common" +powershell write-host -fore Blue Building AMWD.Common + +rmdir /S /Q bin +dotnet build -c %Configuration% --nologo --no-incremental +move bin\%Configuration%\*.nupkg ..\artifacts +move bin\%Configuration%\*.snupkg ..\artifacts + + + +cd "%~dp0" +cd "AMWD.Common.AspNetCore" +powershell write-host -fore Blue Building AMWD.Common.AspNetCore + +rmdir /S /Q bin +dotnet build -c %Configuration% --nologo --no-incremental +move bin\%Configuration%\*.nupkg ..\artifacts +move bin\%Configuration%\*.snupkg ..\artifacts + + + +cd "%~dp0" +cd "AMWD.Common.EntityFrameworkCore" +powershell write-host -fore Blue Building AMWD.Common.EntityFrameworkCore + +rmdir /S /Q bin +dotnet build -c %Configuration% --nologo --no-incremental +move bin\%Configuration%\*.nupkg ..\artifacts +move bin\%Configuration%\*.snupkg ..\artifacts diff --git a/build.sh b/build.sh index 2f0a0e2..bd0b7ee 100644 --- a/build.sh +++ b/build.sh @@ -1,29 +1,30 @@ #!/bin/bash - CONFIGURATION=Release +cd "$(dirname "${0}")" +rm -rf artifacts +mkdir artifacts + +dotnet restore -v q +# dotnet tool restore -v q + pushd AMWD.Common rm -rf bin dotnet build -c ${CONFIGURATION} --nologo --no-incremental +mv bin/${CONFIGURATION}/*.nupkg ../artifacts +mv bin/${CONFIGURATION}/*.snupkg ../artifacts popd pushd AMWD.Common.AspNetCore rm -rf bin dotnet build -c ${CONFIGURATION} --nologo --no-incremental +mv bin/${CONFIGURATION}/*.nupkg ../artifacts +mv bin/${CONFIGURATION}/*.snupkg ../artifacts popd pushd AMWD.Common.EntityFrameworkCore rm -rf bin dotnet build -c ${CONFIGURATION} --nologo --no-incremental +mv bin/${CONFIGURATION}/*.nupkg ../artifacts +mv bin/${CONFIGURATION}/*.snupkg ../artifacts popd - -rm -rf build -mkdir build -mv AMWD.Common/bin/${CONFIGURATION}/*.nupkg build -mv AMWD.Common/bin/${CONFIGURATION}/*.snupkg build - -mv AMWD.Common.AspNetCore/bin/${CONFIGURATION}/*.nupkg build -mv AMWD.Common.AspNetCore/bin/${CONFIGURATION}/*.snupkg build - -mv AMWD.Common.EntityFrameworkCore/bin/${CONFIGURATION}/*.nupkg build -mv AMWD.Common.EntityFrameworkCore/bin/${CONFIGURATION}/*.snupkg build