sdk icon indicating copy to clipboard operation
sdk copied to clipboard

"Unable to locate repository with working directory that contains directory <dir>" even without SourceLink in .Net 8.0

Open SvenGroot opened this issue 3 years ago • 3 comments

Describe the bug

After installing the .Net 8.0 SDK, projects that are cloned from a local directory always show the following warning:

1>C:\Program Files\dotnet\sdk\8.0.100\Sdks\Microsoft.Build.Tasks.Git\build\Microsoft.Build.Tasks.Git.targets(25,5): warning : Unable to locate repository with working directory that contains directory 'D:\Sven\OneDrive\Git\SourceLinkTest.git'.

This happens even though the project has no references to any SourceLink package. The only way I've found to prevent the warning is to put <EnableSourceControlManagerQueries>false</EnableSourceControlManagerQueries> in the csproj file, but I'm not sure if that's the intended behavior. I was only able to find this by looking through various .targets files to find a condition that would prevent the target that emits this warning from being invoked.

To Reproduce

Run the following commands in a directory, using .Net SDK 8.0.100:

mkdir RepoWarning.git
cd RepoWarning.git
git init --bare
cd ..
mkdir RepoWarning
cd RepoWarning
dotnet new classlib
git init
git remote add origin ../RepoWarning.git
dotnet build

Further technical details

.NET SDK:
 Version:           8.0.100
 Commit:            57efcf1350
 Workload version:  8.0.100-manifests.8d38d0cc

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.25997
 OS Platform: Windows
 RID:         win-x64
 Base Path:   C:\Program Files\dotnet\sdk\8.0.100\

.NET workloads installed:
 Workload version: 8.0.100-manifests.8d38d0cc
There are no installed workloads to display.

Host:
  Version:      8.0.0
  Architecture: x64
  Commit:       5535e31a71

.NET SDKs installed:
  8.0.100 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
  x86   [C:\Program Files (x86)\dotnet]
    registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
  Not set

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

SvenGroot avatar Nov 15 '23 19:11 SvenGroot

I encountered what looks to be the same issue after updating Visual Studio from 17.7.4 to 17.8. My solution includes over 60 separate projects, and all of them started reporting that same "sdk 8" repository message, despite all being configured to use DOTNET 7.

Downgrading Visual Studio back to version 17.7.4 resolved the issue for me ... for the time being.

I encountered the same issue. It seems, that a fix for this issue has already been implemented and is now in the Pending Release state as stated here: https://developercommunity.visualstudio.com/t/VS-178:-Unable-to-locate-repository-wit/10519177?space=41&sort=newest

orangedentalGit avatar Dec 13 '23 09:12 orangedentalGit

Thank you for posting the VS issue -- it looks like this was fixed in 17.9.2 so im closing this but if the issue still exists, let us know

nagilson avatar Mar 19 '24 20:03 nagilson