Skip to content

Add alternative casings for finding NuGet.config file. #7549

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/Microsoft.DotNet.Arcade.Sdk/tools/Tools.proj
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@
Configure NuGet Restore to use NuGet.config file in the repository root.
We could drop a custom NuGet.config to the containing directory but it's simpler
if we use the same config for all restore operations.
NuGet.Config, NuGet.config, and nuget.config are all allowed casings according to NuGet:
https://github.com/NuGet/NuGet.Client/blob/b83566ec2369c4e9fd07e6f95d734dfe370a1e66/src/NuGet.Core/NuGet.Configuration/Settings/Settings.cs#L34-L36
-->
<PropertyGroup>
<RestoreConfigFile>$(RepoRoot)NuGet.config</RestoreConfigFile>
<RestoreConfigFile Condition="Exists('$(RepoRoot)NuGet.config')">$(RepoRoot)NuGet.config</RestoreConfigFile>
<RestoreConfigFile Condition="Exists('$(RepoRoot)NuGet.Config')">$(RepoRoot)NuGet.Config</RestoreConfigFile>
<RestoreConfigFile Condition="Exists('$(RepoRoot)nuget.config')">$(RepoRoot)nuget.config</RestoreConfigFile>
Comment on lines +23 to +25
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To bad this cant be made to not care about the casing on the file name at all so one that haves the name and extension in all caps can still be able to use it.

If only nuget could also be updated to not care on it's name case as well too.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we still need this at all since NuGet will automatically pick up the nuget.config in the repo root.

Looking at the history, this was used to make sure NuGet wouldn't pick up a file outside of the repo root (presumably because some repos didn't have one?) but this shouldn't be a supported scenario anymore now that we require using the AzDO feeds.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specifically, this is still required for source-build because some of our contributing repos use different filename casings. We are patching to work around this but it would be really nice to actually have it in Arcade.

</PropertyGroup>

<Import Project="$(_NuGetRestoreTargets)" />
Expand Down