Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker build returns ERROR [build-env 6/6] RUN dotnet publish MSB4186: #3

Open
stefanpems opened this issue Feb 13, 2021 · 2 comments

Comments

@stefanpems
Copy link

Hello.
The command "docker build . -t letskube:local" terminates with:

=> ERROR [build-env 6/6] RUN dotnet publish -c Release -o output 11.4s

[build-env 6/6] RUN dotnet publish -c Release -o output:
#13 2.994 Microsoft (R) Build Engine version 15.7.179.6572 for .NET Core
#13 2.994 Copyright (C) Microsoft Corporation. All rights reserved.
#13 2.994
#13 8.153 Restore completed in 296.43 ms for /app/LetsKube.csproj.
#13 11.03 /usr/share/dotnet/sdk/2.1.202/Sdks/Microsoft.NET.Sdk/build/Microsoft.PackageDependencyResolution.targets(557,9): error MSB4186: Invalid static method invocation syntax: "[System.IO.Directory]::GetParent().get_Name()". System.IO.Directory.GetParent Static method invocation should be of the form: $([FullTypeName]::Method()), e.g. $([System.IO.Path]::Combine(a, b)). [/app/LetsKube.csproj]


executor failed running [/bin/sh -c dotnet publish -c Release -o output]: exit code: 1

@stefanpems
Copy link
Author

This was useful: https://stackoverflow.com/questions/60746280/building-dockerfile-in-asp-net-core-project-fails-when-running-dotnet-publish-c

I solved by creating a new clone from github and launching "docker build" without having firstly executed "dotnet run"

@asingh014
Copy link

asingh014 commented Mar 5, 2021

Also, works once you add ".dockerignore" file in the root directory with the content:

bin/
obj/
out/

then running docker build . -t [ACR-NAME]:[TAG] worked for me :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants