简体   繁体   中英

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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM