Reputation: 687
I have a .NET Core project that contained 2 projects:
SLN:
- Web-API
- Infrastructure
I was building it with docker using this dockerfile
FROM microsoft/aspnetcore-build:2.0 AS build-env
WORKDIR /app
COPY . ./
RUN dotnet restore
COPY . ./
RUN dotnet publish -c Release -o out
# Build runtime image
FROM microsoft/aspnetcore:2.0
WORKDIR /app
COPY --from=build-env /app/ .
ENTRYPOINT ["dotnet", "/app/Lab/out/API.dll"]
But now I have created a Web application as well in my solution
SLN:
- Web-API
- Web-App
- Infrastructure
Suddenly, docker isn't building anymore. How come? How can I create two docker containers based on the same solution one for the Web-API and one for the Web-app?
Error message from Docker:
The "GetDotNetHost" task could not be loaded from the assembly /usr/share/dotnet/sdk/NuGetFallbackFolder/microsoft.aspnetcore.mvc.razor.viewcompilation/2.0.3/build/netstandard2.0/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks.dll. Assembly with same name is already loaded Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. [/app/Lab/API.csproj]
Upvotes: 1
Views: 2570
Reputation: 687
So this problem is now finally fixed. It actually turned out it was a problem while compiling a .net core 2.0 project when having Razor views available:
Razor view precompilation is currently unavailable when performing a self-contained deployment (SCD) in ASP.NET Core 2.0. The feature will be available for SCDs when 2.1 releases. For more information, see View compilation fails when cross-compiling for Linux on Windows.
What I needed to do was to add the nuget package:
Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
in my project to make it work. Strange thing was that it was building inside visual studio for Mac but not from the command prompt.
Upvotes: 1