Dou
Dou
CC#
Created by Dou on 10/29/2023 in #help
Docker container works fine in manual invocation but not when started via VS2022's start button
My project structure:
├── ComBin.sln
├── docker-compose.dcproj
├── docker-compose.dcproj.user
├── docker-compose.override.yml
├── docker-compose.yml
├── launchSettings.json
└── src
├── ComBin.Server
└── combin.client
├── ComBin.sln
├── docker-compose.dcproj
├── docker-compose.dcproj.user
├── docker-compose.override.yml
├── docker-compose.yml
├── launchSettings.json
└── src
├── ComBin.Server
└── combin.client
docker-compose.yml:
version: '3.4'
services:
combin.server:
image: ${DOCKER_REGISTRY-}combinserver
build:
context: .
dockerfile: src/ComBin.Server/Dockerfile
depends_on:
- combin.database
combin.database:
image: postgres:latest
container_name: combin-database
environment:
- POSTGRES_PASSWORD=tobechanged
volumes:
- "combin-database-volume:/var/lib/postgresql/data"
expose:
- "5432"
volumes:
combin-database-volume:
version: '3.4'
services:
combin.server:
image: ${DOCKER_REGISTRY-}combinserver
build:
context: .
dockerfile: src/ComBin.Server/Dockerfile
depends_on:
- combin.database
combin.database:
image: postgres:latest
container_name: combin-database
environment:
- POSTGRES_PASSWORD=tobechanged
volumes:
- "combin-database-volume:/var/lib/postgresql/data"
expose:
- "5432"
volumes:
combin-database-volume:
Dockerfile:
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
USER app
WORKDIR /app
EXPOSE 8080
EXPOSE 8081

FROM node:21-slim AS node-base
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
COPY --from=node-base . .
WORKDIR /src

COPY "src/combin.client/combin.client.esproj" "combin.client/combin.client.esproj"
COPY "src/ComBin.Server/ComBin.Server.csproj" "ComBin.Server/ComBin.Server.csproj"
RUN dotnet restore "./ComBin.Server/./ComBin.Server.csproj"
COPY src .
WORKDIR "/src/ComBin.Server"
RUN dotnet build "./ComBin.Server.csproj" -c $BUILD_CONFIGURATION -o /app/build

FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./ComBin.Server.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "ComBin.Server.dll"]
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
USER app
WORKDIR /app
EXPOSE 8080
EXPOSE 8081

FROM node:21-slim AS node-base
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
COPY --from=node-base . .
WORKDIR /src

COPY "src/combin.client/combin.client.esproj" "combin.client/combin.client.esproj"
COPY "src/ComBin.Server/ComBin.Server.csproj" "ComBin.Server/ComBin.Server.csproj"
RUN dotnet restore "./ComBin.Server/./ComBin.Server.csproj"
COPY src .
WORKDIR "/src/ComBin.Server"
RUN dotnet build "./ComBin.Server.csproj" -c $BUILD_CONFIGURATION -o /app/build

FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./ComBin.Server.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "ComBin.Server.dll"]
When I start the project with docker-compose up it works just fine but starting it via VS fails with this error:
The command could not be loaded, possibly because:
* You intended to execute a .NET application:
The application '/app/ComBin.Server.dll' does not exist.
* You intended to execute a .NET SDK command:
No .NET SDKs were found.
The command could not be loaded, possibly because:
* You intended to execute a .NET application:
The application '/app/ComBin.Server.dll' does not exist.
* You intended to execute a .NET SDK command:
No .NET SDKs were found.
5 replies
CC#
Created by Dou on 9/4/2023 in #help
Get the bytes of byte[] as string
Hi, I have a byte[] like byte[] arr = new byte[] {1,2,3} is there a way to get those 1,2,3 or even better new byte[] {1,2,3}. For more context, what I'm trying to do is, I'm source generating for Roslyn and adding fields to the source code via a method implemented as
private void AddField(string name, string value, string type = "string")
{
_fields.Append($"private static {type} {name} = {value}\r\n");
}
private void AddField(string name, string value, string type = "string")
{
_fields.Append($"private static {type} {name} = {value}\r\n");
}
I want to call
var arr = new byte[] {1,2,3};
AddField("test", /* somehow inline arr to here */, "byte[]")
var arr = new byte[] {1,2,3};
AddField("test", /* somehow inline arr to here */, "byte[]")
5 replies