dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.37k stars 9.99k forks source link

Unable to locate repository with working directory that contains directory ... #44629

Closed ehcarleton closed 1 year ago

ehcarleton commented 2 years ago

Is there an existing issue for this?

Describe the bug

I am trying to get a local copy of .Net 6.0 to step through the code to better understand how some things work. I have downloaded v6.0.10 and when I run the restore.cmd I get the errors below.

One thing I noticed is a lack of documentation on how to build the code correctly. Is there documentation out there that I am missing? If so a link to that would be very helpful.

` dotnet-install: Using alternate version 6.0.10 found in https://dotnetcli.azureedge.net/dotnet/Runtime/6.0.10-servicing.22476.5/runtime-productVersion.txt dotnet-install: Extracting the archive. dotnet-install: Adding to current process PATH: "C:\repos\aspnetcore-6.0.10.dotnet\x86\". Note: This change will not be visible if PowerShell was run as a child process. dotnet-install: Note that the script does not resolve dependencies during installation. dotnet-install: To check the list of dependencies, go to https://docs.microsoft.com/dotnet/core/install/windows#dependencies dotnet-install: Installed version is 6.0.10 dotnet-install: Installation finished Attempting to install dotnet from public location. dotnet-install: Note that the intended use of this script is for Continuous Integration (CI) scenarios, where: dotnet-install: - The SDK needs to be installed without user interaction and without admin rights. dotnet-install: - The SDK installation doesn't need to persist across multiple CI runs. dotnet-install: To set up a development environment or to run apps, use installers rather than this script. Visit https://dotnet.microsoft.com/download to get the installer.

dotnet-install: Extracting the archive. dotnet-install: Note that the script does not resolve dependencies during installation. dotnet-install: To check the list of dependencies, go to https://docs.microsoft.com/dotnet/core/install/windows#dependencies dotnet-install: Installed version is 3.1.28 dotnet-install: Installation finished Determining projects to restore... Restored C:\repos\aspnetcore-6.0.10\eng\tools\RepoTasks\RepoTasks.csproj (in 2.23 sec). C:\Users\Sam.nuget\packages\microsoft.build.tasks.git\1.1.0-beta-20206-02\build\Microsoft.Build.Tasks.Git.targets(24,5): error : Unable to locate repository with working directory that contains directory 'C:\repos\aspnetcore-6.0.10\eng\tools\RepoTasks'. [C:\repos\aspnetcore-6.0.10\eng\tools\RepoTasks\RepoTasks.csproj] C:\Users\Sam.nuget\packages\microsoft.build.tasks.git\1.1.0-beta-20206-02\build\Microsoft.Build.Tasks.Git.targets(47,5): error : Unable to locate repository with working directory that contains directory 'C:\repos\aspnetcore-6.0.10\eng\tools\RepoTasks'. [C:\repos\aspnetcore-6.0.10\eng\tools\RepoTasks\RepoTasks.csproj] C:\Users\Sam.nuget\packages\microsoft.sourcelink.common\1.1.0-beta-20206-02\build\Microsoft.SourceLink.Common.targets(52,5): error : Source control information is not available - the generated source link is empty. [C:\repos\aspnetcore-6.0.10\eng\tools\RepoTasks\RepoTasks.csproj] C:\Users\Sam.nuget\packages\microsoft.build.tasks.git\1.1.0-beta-20206-02\build\Microsoft.Build.Tasks.Git.targets(24,5): error : Unable to locate repository with working directory that contains directory 'C:\repos\aspnetcore-6.0.10\eng\tools\RepoTasks'. [C:\repos\aspnetcore-6.0.10\eng\tools\RepoTasks\RepoTasks.csproj] C:\Users\Sam.nuget\packages\microsoft.build.tasks.git\1.1.0-beta-20206-02\build\Microsoft.Build.Tasks.Git.targets(47,5): error : Unable to locate repository with working directory that contains directory 'C:\repos\aspnetcore-6.0.10\eng\tools\RepoTasks'. [C:\repos\aspnetcore-6.0.10\eng\tools\RepoTasks\RepoTasks.csproj] C:\Users\Sam.nuget\packages\microsoft.sourcelink.common\1.1.0-beta-20206-02\build\Microsoft.SourceLink.Common.targets(52,5): error : Source control information is not available - the generated source link is empty. [C:\repos\aspnetcore-6.0.10\eng\tools\RepoTasks\RepoTasks.csproj] RepoTasks -> C:\repos\aspnetcore-6.0.10\artifacts\bin\RepoTasks\Release\net472\RepoTasks.dll RepoTasks -> C:\repos\aspnetcore-6.0.10\artifacts\bin\RepoTasks\Release\net6.0\RepoTasks.dll Build failed with exit code 1. Check errors above.`

Expected Behavior

I am expecting to build the git repo successfully

Steps To Reproduce

Download the aspnetcore-6.0.10 from github, unzip with 7-zip, open a VS2022 cmd line, execute restore.cmd

Exceptions (if any)

No response

.NET Version

6.0.10

Anything else?

No response

mkArtakMSFT commented 2 years ago

@captainsafia FYI as you've been driving some of this work in the past.

Tratcher commented 2 years ago

I am trying to get a local copy of .Net 6.0 to step through the code to better understand how some things work.

FYI the debug symbols should be publicly available, so you don't need to re-build the source code to step through it. You should be able to step into framework code directly from your own project.

ehcarleton commented 2 years ago

I am trying to get a local copy of .Net 6.0 to step through the code to better understand how some things work.

FYI the debug symbols should be publicly available, so you don't need to re-build the source code to step through it. You should be able to step into framework code directly from your own project.

Thank you, but I need more than the debug symbols. I am doing a deep dive into code where I need to put breakpoints within the .net code. In all my years of experience the only way to do that is to build the libraries myself and link to those libraries.

Tratcher commented 2 years ago

Breakpoints should also work with the existing symbols and dlls. The only difference is that these are optimized release builds so you can't put break points on some lines.

ehcarleton commented 2 years ago

Breakpoints should also work with the existing symbols and dlls. The only difference is that these are optimized release builds so you can't put break points on some lines.

So... are you saying that the issue I am having is or is not a bug? At the end of the day, I am not here to discuss WHY I want to compile it, rather I am seeking wisdom on HOW to compile it. Do you have any thought on the errors I am having?

Tratcher commented 2 years ago

I don't have an immediate answer for why you're having trouble building. I do know that your best bet is to build release/6.0 instead of a specific label. We work to ensure branches build correctly, not labels.

I recommended the symbols approach because it should be easier to accomplish your goals that way.

ehcarleton commented 2 years ago

Cool, I will give that a try. In poking around, it looks like this is the the version you are recommending:

https://github.com/dotnet/aspnetcore/tree/release/6.0

Is my impression correct that downloading the zip file from there should be what I am looking for?

Tratcher commented 2 years ago

I'd recommend git clone https://github.com/dotnet/aspnetcore.git and then git checkout the release/6.0 branch. That will let you move around branches and get updates without redownloading everything.

Tratcher commented 2 years ago

See https://github.com/dotnet/aspnetcore/blob/main/docs/BuildFromSource.md for tips

ehcarleton commented 2 years ago

Thank you!

ehcarleton commented 2 years ago

I followed the BuildFromSource.md and am using a VS2019 PowerShell. Here is the git log:

PS C:\repos\aspnetcore> git log
commit 0ecd7d7c11399750a25130eb32841b31f1030b13 (HEAD -> release/6.0, origin/release/6.0)
Author: dotnet-maestro[bot] <42748379+dotnet-maestro[bot]@users.noreply.github.com>
Date:   Thu Oct 13 13:44:25 2022 -0700

    Update dependencies from https://github.com/dotnet/arcade build 20221012.3 (#44527)

    Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Build.Tasks.Templating , Microsoft.DotNet.Helix.Sdk
     From Version 6.0.0-beta.22463.7 -> To Version 6.0.0-beta.22512.3

    Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>

The output of restore.cmd:

PS C:\repos\aspnetcore> .\restore.cmd
Building of C# project is enabled and has dependencies on NodeJS projects. Building of NodeJS projects is enabled since node is detected in C:\Apps.
Detected JDK in C:\repos\aspnetcore\eng\..\.tools\jdk\win-x64\ (via local repo convention)

  Determining projects to restore...
  Tool 'dotnet-serve' (version '1.7.139') was restored. Available commands: dotnet-serve
  Tool 'playwright-sharp-tool' (version '0.170.2') was restored. Available commands: playwright-sharp

  Restore was successful.
  All projects are up-to-date for restore.
  Determining projects to restore...
  All projects are up-to-date for restore.
  GenerateFiles -> C:\repos\aspnetcore\artifacts\bin\GenerateFiles\Directory.Build.props
  GenerateFiles -> C:\repos\aspnetcore\artifacts\bin\GenerateFiles\Directory.Build.targets
Attempting to install dotnet from public location.
dotnet-install: Note that the intended use of this script is for Continuous Integration (CI) scenarios, where:
dotnet-install: - The SDK needs to be installed without user interaction and without admin rights.
dotnet-install: - The SDK installation doesn't need to persist across multiple CI runs.
dotnet-install: To set up a development environment or to run apps, use installers rather than this script. Visit https://dotnet.microsoft.com/download to get the installer.

dotnet-install: .NET Core Runtime with version '2.1.30' is already installed.
dotnet-install: Adding to current process PATH: "C:\repos\aspnetcore\.dotnet\". Note: This change will not be visible if PowerShell was run as a child process.
Attempting to install dotnet from public location.
dotnet-install: Note that the intended use of this script is for Continuous Integration (CI) scenarios, where:
dotnet-install: - The SDK needs to be installed without user interaction and without admin rights.
dotnet-install: - The SDK installation doesn't need to persist across multiple CI runs.
dotnet-install: To set up a development environment or to run apps, use installers rather than this script. Visit https://dotnet.microsoft.com/download to get the installer.

dotnet-install: Using alternate version 6.0.10 found in https://dotnetcli.azureedge.net/dotnet/Runtime/6.0.10-servicing.22476.5/runtime-productVersion.txt
dotnet-install: .NET Core Runtime with version '6.0.10' is already installed.
dotnet-install: Adding to current process PATH: "C:\repos\aspnetcore\.dotnet\". Note: This change will not be visible if PowerShell was run as a child process.
Attempting to install dotnet from public location.
dotnet-install: Note that the intended use of this script is for Continuous Integration (CI) scenarios, where:
dotnet-install: - The SDK needs to be installed without user interaction and without admin rights.
dotnet-install: - The SDK installation doesn't need to persist across multiple CI runs.
dotnet-install: To set up a development environment or to run apps, use installers rather than this script. Visit https://dotnet.microsoft.com/download to get the installer.

dotnet-install: Using alternate version 6.0.10 found in https://dotnetcli.azureedge.net/dotnet/Runtime/6.0.10-servicing.22476.5/runtime-productVersion.txt
dotnet-install: .NET Core Runtime with version '6.0.10' is already installed.
dotnet-install: Adding to current process PATH: "C:\repos\aspnetcore\.dotnet\x86\". Note: This change will not be visible if PowerShell was run as a child process.
Attempting to install dotnet from public location.
dotnet-install: Note that the intended use of this script is for Continuous Integration (CI) scenarios, where:
dotnet-install: - The SDK needs to be installed without user interaction and without admin rights.
dotnet-install: - The SDK installation doesn't need to persist across multiple CI runs.
dotnet-install: To set up a development environment or to run apps, use installers rather than this script. Visit https://dotnet.microsoft.com/download to get the installer.

dotnet-install: ASP.NET Core Runtime with version '3.1.30' is already installed.
dotnet-install: Adding to current process PATH: "C:\repos\aspnetcore\.dotnet\". Note: This change will not be visible if PowerShell was run as a child process.
  Determining projects to restore...
  All projects are up-to-date for restore.
C:\repos\aspnetcore\.dotnet\sdk\6.0.110\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.DefaultItems.targets(134,5): error NETSDK1182: Targeting .NET 6.0 in Visual Studio 2019 is not supported. [C:\repos\aspnetcore\eng\tools\RepoTasks\RepoTasks.csproj]
C:\Users\Sam\.nuget\packages\microsoft.build.tasks.git\1.1.0-beta-20206-02\build\Microsoft.Build.Tasks.Git.targets(24,5): error : Could not find file 'C:\repos\aspnetcore\src\submodules\googletest\.git'. The source code won't be available via Source Link. [C:\repos\aspnetcore\eng\tools\RepoTasks\RepoTasks.csproj]
C:\Users\Sam\.nuget\packages\microsoft.build.tasks.git\1.1.0-beta-20206-02\build\Microsoft.Build.Tasks.Git.targets(24,5): error : Could not find file 'C:\repos\aspnetcore\src\submodules\MessagePack-CSharp\.git'. The source code won't be available via Source Link. [C:\repos\aspnetcore\eng\tools\RepoTasks\RepoTasks.csproj]
C:\Users\Sam\.nuget\packages\microsoft.build.tasks.git\1.1.0-beta-20206-02\build\Microsoft.Build.Tasks.Git.targets(24,5): error : Could not find file 'C:\repos\aspnetcore\src\submodules\spa-templates\.git'. The source code won't be available via Source Link. [C:\repos\aspnetcore\eng\tools\RepoTasks\RepoTasks.csproj]
C:\Users\Sam\.nuget\packages\microsoft.build.tasks.git\1.1.0-beta-20206-02\build\Microsoft.Build.Tasks.Git.targets(24,5): error : Could not find file 'C:\repos\aspnetcore\src\submodules\googletest\.git'. The source code won't be available via Source Link. [C:\repos\aspnetcore\eng\tools\RepoTasks\RepoTasks.csproj]
C:\Users\Sam\.nuget\packages\microsoft.build.tasks.git\1.1.0-beta-20206-02\build\Microsoft.Build.Tasks.Git.targets(24,5): error : Could not find file 'C:\repos\aspnetcore\src\submodules\MessagePack-CSharp\.git'. The source code won't be available via Source Link. [C:\repos\aspnetcore\eng\tools\RepoTasks\RepoTasks.csproj]
C:\Users\Sam\.nuget\packages\microsoft.build.tasks.git\1.1.0-beta-20206-02\build\Microsoft.Build.Tasks.Git.targets(24,5): error : Could not find file 'C:\repos\aspnetcore\src\submodules\spa-templates\.git'. The source code won't be available via Source Link. [C:\repos\aspnetcore\eng\tools\RepoTasks\RepoTasks.csproj]
  RepoTasks -> C:\repos\aspnetcore\artifacts\bin\RepoTasks\Release\net472\RepoTasks.dll
  RepoTasks -> C:\repos\aspnetcore\artifacts\bin\RepoTasks\Release\net6.0\RepoTasks.dll
Build failed with exit code 1. Check errors above.
Tratcher commented 2 years ago

C:\Users\Sam.nuget\packages\microsoft.build.tasks.git\1.1.0-beta-20206-02\build\Microsoft.Build.Tasks.Git.targets(24,5): error : Could not find file 'C:\repos\aspnetcore\src\submodules\googletest.git'. The source code won't be available via Source Link. [C:\repos\aspnetcore\eng\tools\RepoTasks\RepoTasks.csproj]

Clone the repo locally using the git clone command. Since this repo contains submodules, you'll need to pass the --recursive flag to pull the sources for the submodules locally. git submodule update --init --recursive

ehcarleton commented 2 years ago

While I read the thing about submodules in the instrutions I glossed over it because I didn't know about the concept, that got me a whole lot father, but I am seeing another error. I am thinking I should be using VS2022 since VS2019 doesn't support .Net 6, correct?

dotnet-install: Using alternate version 6.0.10 found in https://dotnetcli.azureedge.net/dotnet/Runtime/6.0.10-servicing.22476.5/runtime-productVersion.txt
dotnet-install: .NET Core Runtime with version '6.0.10' is already installed.
dotnet-install: Adding to current process PATH: "C:\repos\aspnetcore\.dotnet\x86\". Note: This change will not be visible if PowerShell was run as a child process.
Attempting to install dotnet from public location.
dotnet-install: Note that the intended use of this script is for Continuous Integration (CI) scenarios, where:
dotnet-install: - The SDK needs to be installed without user interaction and without admin rights.
dotnet-install: - The SDK installation doesn't need to persist across multiple CI runs.
dotnet-install: To set up a development environment or to run apps, use installers rather than this script. Visit https://dotnet.microsoft.com/download to get the installer.

dotnet-install: ASP.NET Core Runtime with version '3.1.30' is already installed.
dotnet-install: Adding to current process PATH: "C:\repos\aspnetcore\.dotnet\". Note: This change will not be visible if PowerShell was run as a child process.
  Determining projects to restore...
  All projects are up-to-date for restore.
C:\repos\aspnetcore\.dotnet\sdk\6.0.110\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.DefaultItems.targets(134,5): error NETSDK1182: Targeting .NET 6.0 in Visual Studio 2019 is not supported. [C:\repos\aspnetcore\eng\tools\RepoTasks\RepoTasks.csproj]
  RepoTasks -> C:\repos\aspnetcore\artifacts\bin\RepoTasks\Release\net472\RepoTasks.dll
  RepoTasks -> C:\repos\aspnetcore\artifacts\bin\RepoTasks\Release\net6.0\RepoTasks.dll
Build failed with exit code 1. Check errors above.
captainsafia commented 2 years ago

While I read the thing about submodules in the instrutions I glossed over it because I didn't know about the concept, that got me a whole lot father, but I am seeing another error. I am thinking I should be using VS2022 since VS2019 doesn't support .Net 6, correct?

dotnet-install: Using alternate version 6.0.10 found in https://dotnetcli.azureedge.net/dotnet/Runtime/6.0.10-servicing.22476.5/runtime-productVersion.txt
dotnet-install: .NET Core Runtime with version '6.0.10' is already installed.
dotnet-install: Adding to current process PATH: "C:\repos\aspnetcore\.dotnet\x86\". Note: This change will not be visible if PowerShell was run as a child process.
Attempting to install dotnet from public location.
dotnet-install: Note that the intended use of this script is for Continuous Integration (CI) scenarios, where:
dotnet-install: - The SDK needs to be installed without user interaction and without admin rights.
dotnet-install: - The SDK installation doesn't need to persist across multiple CI runs.
dotnet-install: To set up a development environment or to run apps, use installers rather than this script. Visit https://dotnet.microsoft.com/download to get the installer.

dotnet-install: ASP.NET Core Runtime with version '3.1.30' is already installed.
dotnet-install: Adding to current process PATH: "C:\repos\aspnetcore\.dotnet\". Note: This change will not be visible if PowerShell was run as a child process.
  Determining projects to restore...
  All projects are up-to-date for restore.
C:\repos\aspnetcore\.dotnet\sdk\6.0.110\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.DefaultItems.targets(134,5): error NETSDK1182: Targeting .NET 6.0 in Visual Studio 2019 is not supported. [C:\repos\aspnetcore\eng\tools\RepoTasks\RepoTasks.csproj]
  RepoTasks -> C:\repos\aspnetcore\artifacts\bin\RepoTasks\Release\net472\RepoTasks.dll
  RepoTasks -> C:\repos\aspnetcore\artifacts\bin\RepoTasks\Release\net6.0\RepoTasks.dll
Build failed with exit code 1. Check errors above.

Correct, I'd recommend following the instructions in the docs for installing the correct VS version and its components via the installation script.

ehcarleton commented 2 years ago

Correct, I'd recommend following the instructions in the docs for installing the correct VS version and its components via the installation script.

Yes, agreed. I now have three versions of VS2019, the latest one that was installed yesterday is VS2019 (3). Here is what I find interesting:

  1. When I run VS2019, I cannot create a .Net 6 project because it does not support it.
  2. The error msg I am getting is clearly stating "error NETSDK1182: Targeting .NET 6.0 in Visual Studio 2019 is not supported."
  3. The documentation says to use VS2019 and the install script installs VS2019

I am not really understanding why the documentation says to use VS2019 and the install script installs VS2019, but all other indications seem to say that VS2019 does not support .Net 6. What am I missing?

captainsafia commented 2 years ago

@ehcarleton OK! I think I figured out the issue. It appears that the release/6.0 branch is missing the changes introduced in https://github.com/dotnet/aspnetcore/pull/34401 which update the install scripts to the correct version of VS. You can try cherry-pick that change or install VS2022 directly.

dougbu commented 1 year ago

@captainsafia I suspect something has changed wrt VS 2019's support for .net6.0. Could you track down which version we actually need and update global.json and the VS installation files as appropriate please❔

dougbu commented 1 year ago

Now thinking the confusion here relates to #38592 not having been backported to release/6.0. #34401 and it's #34461 fixup are definitely already in the branch.

In addition, I believe net6.0 support was temporarily removed from VS 2019. @marcpopMSFT is that right❔ And, if so, how do we get away w/ using VS 2019 in our release/6.0 CI builds and has net6.0 support been restored yet❔

dougbu commented 1 year ago

See #45381 for a manual backport of #38592

dougbu commented 1 year ago

Fixed a while back w/ #45381