Open quixoticaxis opened 1 year ago
Did you enable experimental SHA-256 support in your git repository? i.e. when you created your git repository, did you do git init --object-format sha256
?
If you aren't sure, you can do git config extensions.objectformat
. If it prints "sha256" then you are using the SHA256 extension.
I would guess that Microsoft.Build.Tasks.Git.targets
does not support SHA256 Git repositories, which makes sense given that it is experimental.
You will need to re-initialize the Git repository without the objectformat extension to change back to SHA1 - you can't change it after the repository has been initialized.
I can reproduce this with a SHA256 repository:
~/Projects/sha256-repo ❮ x64
❯ dotnet build
MSBuild version 17.8.0-preview-23367-03+0ff2a83e9 for .NET
Determining projects to restore...
All projects are up-to-date for restore.
/usr/local/share/dotnet/sdk/8.0.100-preview.7.23376.3/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.RuntimeIdentifierInference.targets(314,5): message NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy [/Users/vcsjones/Projects/sha256-repo/sha256-repo.csproj]
/usr/local/share/dotnet/sdk/8.0.100-preview.7.23376.3/Sdks/Microsoft.Build.Tasks.Git/build/Microsoft.Build.Tasks.Git.targets(25,5): error : Error reading git repository information: Unsupported repository extension 'objectformat'. Only noop, preciousObjects, partialclone, worktreeConfig are supported. [/Users/vcsjones/Projects/sha256-repo/sha256-repo.csproj]
@vcsjones , thank you. Yes, I use SHA-256. Is it possible to somehow turn off the integration?
There's a condition on $(SuppressImplicitGitSourceLink)
here: https://github.com/dotnet/sdk/blob/b9a275259a7a2e993ba6a21676a2679a7e128814/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.CrossTargeting.targets#L15
More broadly you can disable SourceLink for a given project/repository by setting See below, this isn't enough and other properties are needed.EnableSourceLink
to false
.
Hey @tmat should this get moved to dotnet/sourcelink and triaged?
(also we're going to start tagging sourcelink-related issues with the Area-SourceLink label - can your team do periodic triage of these?)
More broadly you can disable SourceLink for a given project/repository by setting
EnableSourceLink
tofalse
.
This does not work: <EnableSourceLink>false</EnableSourceLink>
This does: <SuppressImplicitGitSourceLink>true</SuppressImplicitGitSourceLink>
Yes, please move the issue to dotnet/sourcelink
EnableSourceLink
wouldn't disable all git information reading as Source Link file generator is not the only build task that reads the git data. Setting EnableSourceControlManagerQueries
to false
should do.
SuppressImplicitGitSourceLink
also works since it removes all implicitly added Source Link packages.
@tmat I can't transfer (perhaps due to permissions?) - can you transfer from this repo to dotnet/sourcelink?
Description
When I try to build a new console project inside a particular git repository the build fails:
When the same project is moved out of git repository, it builds fine.
Reproduction Steps
I cannot reproduce the bug inside freshly initialized git repositories.
Expected behavior
The build cares not about whether the project is under the source control and succeeds.
Actual behavior
The build fails with cryptic error:
Regression?
Probably not, never experienced it with any version of .Net (or .Net Framework).
Known Workarounds
It is possible to work with the project out of source control and constantly moving it in and out of repository, but that's a hustle.
Configuration
dotnet:
dotnet --version
-> 8.0.100-preview.7.23376.3 OS:lsb_release -a
-> Ubuntu 22.04.3 LTS (Actually, Kubuntu). Architecture: x64. I don't know whether it is specific to configuration. I do not use Blazor.Other information
No response