4

I am having Windows 10 Home operating system. I have installed Docker toolbox. I want to deploy my .net core application to Docker. I created my Docker file by referring to following helpful article: https://stormpath.com/blog/tutorial-deploy-asp-net-core-on-linux-with-docker

My docker file is as follows:

FROM microsoft/dotnet:latest
COPY . /app
WORKDIR /app

RUN ["dotnet", "restore"]
RUN ["dotnet", "build"]

EXPOSE 5000/tcp
ENV ASPNETCORE_URLS http://*:5000

ENTRYPOINT ["dotnet", "run"]

But when I run, docker command for creating image, it gives me error.

user@machine_name MINGW64 path to solution
$  docker build -t helloWorld:core .

Error:

/app/Web.xproj(7,3): error MSB4019: The imported project "/usr/share/dotnet/sdk/1.0.0-rc4-004771/Microsoft/VisualStudio/v14.0/DotNet/Microsoft.DotNet.Props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
The command 'dotnet restore' returned a non-zero code: 1

Can someone please guide, what is going wrong over here, as I am completely new to Docker.

1 Answer 1

5

As I see Web.xproj in your error, look like you have the same problem as described in this github issue. The root of such problem is that Microsoft updated their docker to the newest SDK which moves back to .csproj from project.json. The solution is to use another, 1.1-sdk-projectjson tag:

FROM microsoft/dotnet:1.1-sdk-projectjson

Note on microsoft/dotnet/ docker page:

The latest tag no longer uses the project.json project format, but has now been updated to be csproj/MSBuild-based. If you do not wish to migrate your existing projects to MSBuild simply change your Dockerfile to use the 1.1.0-sdk-projectjson or 1.1.0-sdk-projectjson-nanoserver tag. Going forward, new .NET Core sdk images will be MSBuild-based.

Sign up to request clarification or add additional context in comments.

9 Comments

I changed image name from "microsoft/dotnet:latest" to "microsoft/1.1-sdk-projectjson" in docker file. But it gives me following error "repository microsoft/1.1-sdk-projectjson not found: does not exist or no pull access".
@PurnimaNaik sorry, 1.1.0-sdk-projectjson is a tag, not image. I have edited answer. You need to use microsoft/dotnet:1.1-sdk-projectjson
Now restore works partially. It is not able to resolve my .net core libraries. It gives me error "Unable to resolve 'Logging.Interfaces (>= 1.0.0)' for '.NETCoreApp,Version=v1.1'". Can you please tell me why I am getting this? I am getting this error for all my libraries.
@PurnimaNaik it is difficult to say exactly without your project.json file. Recheck that you use correct package versions for 1.1 sdk version. Like "Microsoft.Extensions.Logging": "1.1.0",, not "Microsoft.Extensions.Logging": "1.0.0",
But I am getting this error for the project libraries created by me, and not for Microsoft dll. Microsoft libraries restore is working fine. Should i share my project.json file?
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.