在 dotnet 构建或发布期间无法找到包含目录的存储库
Unable to locate repository containing directory during dotnet build or publish
我在我的 ASP.NET Core 2.2 应用程序上添加了对 Docker 的支持,在本地测试 docker 的命令时,我发现 dotnet publish -f netcoreapp2.2 -c Release -o 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
dotnet restore
在与解决方案相同的文件夹中的输出:
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.
dotnet publish -f netcoreapp2.2 -c Release -o out
在与解决方案相同的文件夹中的输出:
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/
我已经尝试 运行 从 WebApp 文件夹 (/Users/paul/docker/IdentityServer) 恢复和发布命令,它产生相同的输出。
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
问题是我引用了一个名为 IdentityServer4 的项目,该项目引用了正在寻找 .git 文件夹的 Sourcelink NuGet 包。删除包引用已解决问题。
我可以确认@Paul 解决方案。我编辑了 .csproj 文件并删除了对 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>
我在我的 ASP.NET Core 2.2 应用程序上添加了对 Docker 的支持,在本地测试 docker 的命令时,我发现 dotnet publish -f netcoreapp2.2 -c Release -o 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
dotnet restore
在与解决方案相同的文件夹中的输出:
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.
dotnet publish -f netcoreapp2.2 -c Release -o out
在与解决方案相同的文件夹中的输出:
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/
我已经尝试 运行 从 WebApp 文件夹 (/Users/paul/docker/IdentityServer) 恢复和发布命令,它产生相同的输出。
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
问题是我引用了一个名为 IdentityServer4 的项目,该项目引用了正在寻找 .git 文件夹的 Sourcelink NuGet 包。删除包引用已解决问题。
我可以确认@Paul 解决方案。我编辑了 .csproj 文件并删除了对 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>