dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.69k stars 1.06k forks source link

dotnetcli fails when solution has a dcproj included #8641

Closed pms1969 closed 4 years ago

pms1969 commented 7 years ago

Steps to reproduce

docker pull pms1969/docker-sln-fails-dotnetcli then docker run --rm pms1969/docker-sln-fails-dotnetcli

This is a base aspnetcore2.0 project solution with the added docker support from VS2017.

Expected behavior

The run command executes the build.sh file which is a dotnet restore followed by a dotnet build. I'd expect this to work.

Actual behavior

.
.
.
  Restore completed in 10.93 sec for /root/app/WebApplication1/WebApplication1.csproj.
/root/app/docker-compose.dcproj : error MSB4236: The SDK 'Microsoft.Docker.Sdk' specified could not be found.
/root/app/docker-compose.dcproj : warning NU1503: Skipping restore for project '/root/app/docker-compose.dcproj'. The project file may be invalid or missing targets required for restore. [/root/app/WebApplication1.sln]
Microsoft (R) Build Engine version 15.3.409.57025 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

/root/app/docker-compose.dcproj : error MSB4236: The SDK 'Microsoft.Docker.Sdk' specified could not be found.
  WebApplication1 -> /root/app/WebApplication1/bin/Debug/netcoreapp2.0/WebApplication1.dll

Build FAILED.

/root/app/docker-compose.dcproj : error MSB4236: The SDK 'Microsoft.Docker.Sdk' specified could not be found.
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:06.03

As you can see, it fails. I've tried excluding it from specific build configurations, but this still happens, which forces the exclusion of the docker project from the solution. This isn't so helpful for the devs who could really do with running it as it will be run in production.

Environment data

dotnet --info output:

λ docker run --rm -ti pms1969/docker-sln-fails-dotnetcli:latest dotnet --info
.NET Command Line Tools (2.0.0)

Product Information:
 Version:            2.0.0
 Commit SHA-1 hash:  cdcd1928c9

Runtime Environment:
 OS Name:     debian
 OS Version:  9
 OS Platform: Linux
 RID:         linux-x64
 Base Path:   /usr/share/dotnet/sdk/2.0.0/

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.0
  Build    : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d

although I can confirm that I've had the same problem when running this on a windows box with dotnetcore 2.0 installed.

Hopefully that's all the information that's required.....

NB: I think it would be useful if dcproj files were excluded form the list of solutions/projects found by the dotnet cli. Since it is added at the root of the solution, you are currently forced to explicitly state the project/solution file you want to run against the tool - which will pretty much never by the dcproj file.

pms1969 commented 7 years ago

looks like it might be a duplicate of https://github.com/dotnet/cli/issues/6178

philcontrolf1 commented 7 years ago

@pms1969 Yep, definitely a duplicate.

livarcocc commented 7 years ago

Closing in favor of https://github.com/dotnet/cli/issues/6178.