Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't build ASP.NET Core app that references PCL in docker

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?

like image 520
marcusturewicz Avatar asked Jun 01 '17 02:06

marcusturewicz


1 Answers

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

like image 129
marcusturewicz Avatar answered Nov 15 '22 02:11

marcusturewicz