1
0

Build-Fixes, string.ParseDecimal

This commit is contained in:
2021-10-24 18:13:52 +02:00
parent b74eb5b958
commit 197ed5e35f
5 changed files with 72 additions and 43 deletions

View File

@@ -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

View File

@@ -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;
}
/// <summary>
/// Parses a <see cref="string"/> to a <see cref="decimal"/> using culture "de" or invariant.
/// </summary>
/// <param name="decString">The string to parse.</param>
/// <returns></returns>
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);
}
}
}

View File

@@ -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

42
build.cmd Normal file
View File

@@ -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

View File

@@ -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