I am trying to build an ASP.NET Core docker image with following Dockerfile:
FROM microsoft/aspnetcore-build:1.1.1
WORKDIR /app
COPY src .
RUN dotnet restore
RUN dotnet publish --output /out/ --configuration Release
EXPOSE 5000
ENTRYPOINT ["dotnet","/out/MyWebApp.dll"]
The build fails, and it gives the following error:
/app/MyPCL/MyPCL.csproj(70,3): error MSB4019: The imported project "/usr/share/dotnet/sdk/1.0.1/Microsoft/Portable/v4.5/Microsoft.Portable.CSharp.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.
So it is having trouble building the PCL library, as it can't find Microsoft.Portable.CSharp.targets.
My PCL project file has the following import statement:
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
which I am thinking is causing the problem, as this path must not exist in the docker container. BTW, the project builds and runs perfectly in Visual Studio 2017.
Any ideas?
It seems like this is not possible yet, but they are working on it:
https://github.com/dotnet/cli/issues/5504
https://developercommunity.visualstudio.com/content/problem/25063/building-running-publishing-a-aspnet-core-net-fram.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With