You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Irrelevant nuget.config on parent directory makes build failure on project directory.
To Reproduce
Create a solution directory
$ mkdir $HOME/Projects/some-project
Initialize a solution with a console project inside the solution directory
$ cd $HOME/Projects/some-project
$ dotnet new sln --name SomeProject \
&& dotnet new console --name SomeProject \
&& dotnet sln add SomeProject
Test build success
$ dotnet build
Determining projects to restore...
All projects are up-to-date for restore.
SomeProject -> /home/huypn12/Projects/some-project/SomeProject/bin/Debug/net8.0/SomeProject.dll
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:03.35
Now create an invalid nuget config on the parent directory:
$ cd $HOME/Projects/some-project
$ dotnet build
Determining projects to restore...
/usr/share/dotnet/sdk/8.0.404/NuGet.targets(745,5): error : NuGet.Config does not contain the expected root element: 'configuration'. Path: '/home/huypn12/Projects/nuget.config'. [/home/huypn12/Projects/some-project/SomeProject/SomeProject.csproj]
Build FAILED.
/usr/share/dotnet/sdk/8.0.404/NuGet.targets(745,5): error : NuGet.Config does not contain the expected root element: 'configuration'. Path: '/home/huypn12/Projects/nuget.config'. [/home/huypn12/Projects/some-project/SomeProject/SomeProject.csproj]
0 Warning(s)
1 Error(s)
Discussion
Why is such behaviour? Is it because of some recursive nuget.config checking?
Perhaps it makes more sense to have dotnet build command to check the nuget.config file of the current project directory?
Which part of the dotnet sdk is responsible for the behaviour?
Further technical details
.NET SDK:
Version: 8.0.404
Commit: 7b190310f2
Workload version: 8.0.400-manifests.4d7d414a
MSBuild version: 17.11.9+a69bbaaf5
Runtime Environment:
OS Name: debian
OS Version: 12
OS Platform: Linux
RID: linux-x64
Base Path: /usr/share/dotnet/sdk/8.0.404/
.NET workloads installed:
Configured to use loose manifests when installing new manifests.
There are no installed workloads to display.
Host:
Version: 8.0.11
Architecture: x64
Commit: 9cb3b725e3
.NET SDKs installed:
8.0.404 [/usr/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.11 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.11 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
None
Environment variables:
Not set
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
The text was updated successfully, but these errors were encountered:
Describe the bug
Irrelevant
nuget.config
on parent directory makes build failure on project directory.To Reproduce
Create a solution directory
Initialize a solution with a console project inside the solution directory
Test build success
Now create an invalid nuget config on the parent directory:
Test build: failed
Discussion
Why is such behaviour? Is it because of some recursive
nuget.config
checking?Perhaps it makes more sense to have
dotnet build
command to check thenuget.config
file of the current project directory?Which part of the dotnet sdk is responsible for the behaviour?
Further technical details
The text was updated successfully, but these errors were encountered: