I am adding support for Docker on my ASP.NET Core 2.2 app and while testing the commands for docker locally I've found that the dotnet publish -f netcoreapp2.2 -c Release -o out
errors out.
./IdentityServer.sln
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IdentityServer", "IdentityServer\IdentityServer.csproj", "{A435DE31-3D1C-4228-BBD9-0157E849D07D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Dependencies", "Dependencies", "{0A7E3F1D-5162-463F-BAF8-714C7FD37B8C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IdentityServer4", "dependencies\identityserver4\src\IdentityServer4.csproj", "{3A32B19C-B6FC-4A2D-9421-5A16849B7C2A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IdentityServer4.AspNetIdentity", "dependencies\identityserver4.aspnetidentity\src\IdentityServer4.AspNetIdentity.csproj", "{0E36AE9A-B9B6-4E1C-B446-82A3265432F8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IdentityServer.Email", "IdentityServer.Email\IdentityServer.Email.csproj", "{BD699934-C404-4CF4-B77C-511E584D1754}"
EndProject
./IdentityServer/IdentityServer.csproj: https://gist.github.com/paulcsiki/4d3b827af418044dacea0149a2361b81
Output of dotnet restore
on the same folder as the solution:
Restore completed in 52.96 ms for /Users/paul/docker/dependencies/identityserver4.aspnetidentity/src/IdentityServer4.AspNetIdentity.csproj.
Restore completed in 52.96 ms for /Users/paul/docker/dependencies/identityserver4/src/IdentityServer4.csproj.
Restore completed in 54.56 ms for /Users/paul/docker/IdentityServer/IdentityServer.csproj.
Restore completed in 52.97 ms for /Users/paul/docker/IdentityServer.Email/IdentityServer.Email.csproj.
Output of the dotnet publish -f netcoreapp2.2 -c Release -o out
on the same folder as the solution:
Microsoft (R) Build Engine version 15.9.20+g88f5fadfbe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
Restore completed in 44.29 ms for /Users/paul/docker/dependencies/identityserver4/src/IdentityServer4.csproj.
Restore completed in 44.3 ms for /Users/paul/docker/IdentityServer.Email/IdentityServer.Email.csproj.
Restore completed in 45.91 ms for /Users/paul/docker/IdentityServer/IdentityServer.csproj.
Restore completed in 44.3 ms for /Users/paul/docker/dependencies/identityserver4.aspnetidentity/src/IdentityServer4.AspNetIdentity.csproj.
/Users/paul/.nuget/packages/microsoft.build.tasks.git/1.0.0-beta-63127-02/build/Microsoft.Build.Tasks.Git.targets(20,5): error : Unable to locate repository containing directory '/Users/paul/docker/dependencies/identityserver4/src'. [/Users/paul/docker/dependencies/identityserver4/src/IdentityServer4.csproj]
IdentityServer.Email -> /Users/paul/docker/IdentityServer.Email/bin/Release/netcoreapp2.2/IdentityServer.Email.dll
IdentityServer.Email -> /Users/paul/docker/IdentityServer.Email/bin/Release/netcoreapp2.2/IdentityServer.Email.Views.dll
IdentityServer.Email -> /Users/paul/docker/IdentityServer.Email/out/
I've tried running the restore and publish command from the WebApp folder (/Users/paul/docker/IdentityServer) and it yields the same output.
Output of the file /Users/paul/docker/dependencies/identityserver4/src/IdentityServer4.csproj
:
/Users/paul/docker/dependencies/identityserver4/src/IdentityServer4.csproj: exported SGML document text, UTF-8 Unicode (with BOM) text
The problem was that I have referenced a project called IdentityServer4 which had a reference to the Sourcelink NuGet package which was looking for the .git folder. Removing the package reference has resolved the issue.
I can confirm @Paul solution. I edited the .csproj file and removed the package reference to Microsoft.SourceLink.GitHub
:
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<!-- Remove following line: -->
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta-62925-02" PrivateAssets="All" />
</ItemGroup>
</Project>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With