Robin Lindner
Robin Lindner
Explore posts from servers
CC#
Created by Robin Lindner on 9/25/2023 in #help
❔ PDF Library for Printing & Rendering?
Does any of you know some .NET PDF-Library, which is able to print against a Windows Printer? Most printers I want to support, do not support PDF directly... Only ZPL, PCL, ...
2 replies
CC#
Created by Robin Lindner on 1/10/2023 in #help
❔ Docker + .NET [open / unresolved]
Hey all, I want to build a docker container which consumes a NuGet Package from a nuget feed behind a proxy. The problem is, it does not work:
10 replies
CC#
Created by Robin Lindner on 12/19/2022 in #help
❔ LaTeX CS Syntax Highlighting
Hi all, I need a syntax highlighting for C# in LaTeX using the Listings package. What I find on the internet either does not work or is on a very old C# standard. Can you help me peepoCoffeeChristmas
4 replies
CC#
Created by Robin Lindner on 9/27/2022 in #help
NuGet behind a proxy
Hey I am in the process of releasing a .NET project as a Docker container. How can I configure Nuget to use the proxy from the HTTP_PROXY & HTTPS_PROXY environment variables? Currently it fails on restore as it can't resolve the feed. Current Dockerfile:
FROM mcr.microsoft.com/dotnet/runtime:6.0-alpine AS base
WORKDIR /app

FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine AS build
ARG HTTP_PROXY
ARG HTTPS_PROXY
ARG AZURE_DEVOPS_ACCESS_TOKEN
ENV HTTP_PROXY ${HTTP_PROXY}
ENV HTTPS_PROXY ${HTTPS_PROXY}
ENV AZURE_DEVOPS_ACCESS_TOKEN ${AZURE_DEVOPS_ACCESS_TOKEN}
WORKDIR /src
RUN dotnet nuget add source --name "my_feed" --username unused --store-password-in-clear-text --password ${AZURE_DEVOPS_ACCESS_TOKEN} "http://my_feed.tld/nuget/v3/index.json"
COPY ["tools/InboxCleanup/InboxCleanup.csproj", "tools/InboxCleanup/"]
COPY ["tools/lib/KMS.Tools.Common/KMS.Tools.Lib.Common.csproj", "tools/lib/KMS.Tools.Common/"]
RUN dotnet restore "tools/InboxCleanup/InboxCleanup.csproj"
COPY . .
WORKDIR "/src/tools/InboxCleanup"
RUN dotnet build "InboxCleanup.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "InboxCleanup.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "InboxCleanup.dll"]
FROM mcr.microsoft.com/dotnet/runtime:6.0-alpine AS base
WORKDIR /app

FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine AS build
ARG HTTP_PROXY
ARG HTTPS_PROXY
ARG AZURE_DEVOPS_ACCESS_TOKEN
ENV HTTP_PROXY ${HTTP_PROXY}
ENV HTTPS_PROXY ${HTTPS_PROXY}
ENV AZURE_DEVOPS_ACCESS_TOKEN ${AZURE_DEVOPS_ACCESS_TOKEN}
WORKDIR /src
RUN dotnet nuget add source --name "my_feed" --username unused --store-password-in-clear-text --password ${AZURE_DEVOPS_ACCESS_TOKEN} "http://my_feed.tld/nuget/v3/index.json"
COPY ["tools/InboxCleanup/InboxCleanup.csproj", "tools/InboxCleanup/"]
COPY ["tools/lib/KMS.Tools.Common/KMS.Tools.Lib.Common.csproj", "tools/lib/KMS.Tools.Common/"]
RUN dotnet restore "tools/InboxCleanup/InboxCleanup.csproj"
COPY . .
WORKDIR "/src/tools/InboxCleanup"
RUN dotnet build "InboxCleanup.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "InboxCleanup.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "InboxCleanup.dll"]
6 replies
CC#
Created by Robin Lindner on 9/15/2022 in #help
Supress NU1803
1 replies
CC#
Created by Robin Lindner on 9/9/2022 in #help
LINQ Lambda-Expression Diff
It's probably very simple, I'm just on the fence today. The Lambda version works as expected the Expression version does not. Do you see where the difference is? Works:
var groupedOccurences = occurences
.SelectMany(static occurence => occurence.MailAddress.Split(',', StringSplitOptions.RemoveEmptyEntries).Select(addr => new
{
MailAddress = addr.Trim(),
occurence.DatabasePath,
occurence.MaskName
}))
.GroupBy(static occurence => occurence);
var groupedOccurences = occurences
.SelectMany(static occurence => occurence.MailAddress.Split(',', StringSplitOptions.RemoveEmptyEntries).Select(addr => new
{
MailAddress = addr.Trim(),
occurence.DatabasePath,
occurence.MaskName
}))
.GroupBy(static occurence => occurence);
Does not work (different results):
var groupedOccurences = from occurence in occurences
from address in occurence.MailAddress.Split(',', StringSplitOptions.RemoveEmptyEntries)
group new {
MailAddress = address.Trim(),
occurence.DatabasePath,
occurence.MaskName
} by occurence into grp
select grp;
var groupedOccurences = from occurence in occurences
from address in occurence.MailAddress.Split(',', StringSplitOptions.RemoveEmptyEntries)
group new {
MailAddress = address.Trim(),
occurence.DatabasePath,
occurence.MaskName
} by occurence into grp
select grp;
7 replies