Issue when running application in devspaces azure kubernetes service

10/25/2019

I am trying to run asp.net core webapi application in devspaces azure kubernetes service it is running good but when i am referencing dotnercore class library to webapi project and trying to run the application i am getting error as follows Skipping project "/src/CommandStack/ClassLibrary1/ClassLibrary1.csproj" because it was not found. "/usr/share/dotnet/sdk/2.2.401/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(208,5): error NETSDK1004: Assets file '/src/CommandStack/ClassLibrary1/obj/project.assets.json' not found. Run a NuGet package restore to generate this file. [/src/CommandStack/ClassLibrary1/ClassLibrary1.csproj]"

My docker file is as follows:

FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-stretch-slim AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/core/sdk:2.2-stretch AS build
WORKDIR /src
COPY ["CommandStack/WebApplication1/WebApplication1.csproj", "CommandStack/WebApplication1/"]
COPY ["CommandStack/ClassLibrary1/ClassLibrary1.csproj", "CommandStack/ClassLibrary1/"]
RUN dotnet restore "CommandStack/WebApplication1/WebApplication1.csproj"
COPY . .
WORKDIR "/src/CommandStack/WebApplication1"
RUN dotnet build "WebApplication1.csproj" -c Release -o /app

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

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "WebApplication1.dll"]

However i am able to run the application using IISExpress.

Any suggestions will be great help.

-- Saiteja Prattipati
asp.net-core
azure
azure-dev-spaces
azure-kubernetes
docker

0 Answers