-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
explicitly override TreatWarningsAsErrors
to false
during discovery
#11786
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
03e6712
to
2c81a6a
Compare
brettfo
commented
Mar 11, 2025
@@ -69,6 +75,105 @@ public static TestHttpServer CreateTestStringServer(Func<string, (int, string)> | |||
return CreateTestServer(bytesRequestHandler); | |||
} | |||
|
|||
public static TestHttpServer CreateTestNuGetFeed(params MockNuGetPackage[] packages) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We commonly need to create test-only HTTP NuGet feeds. In the case where the feed is expected to be well-behaved, this helper makes it a one-line addition to a test.
brettfo
commented
Mar 11, 2025
nuget/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/SdkProjectDiscovery.cs
Show resolved
Hide resolved
2c81a6a
to
69c33de
Compare
1 task
ryanbrandenburg
approved these changes
Mar 11, 2025
ryanbrandenburg
approved these changes
Mar 11, 2025
6f5218a
to
a5dbec2
Compare
honeyankit
approved these changes
Mar 11, 2025
a5dbec2
to
321f6bc
Compare
321f6bc
to
cf208e3
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If all of the following are true:
NuGet.Config
file (or it does but doesn't specify the<clear />
directive)Directory.Packages.props
)$(TreatWarningsAsErrors)
totrue
dependabot.yml
file lists custom NuGet feeds...then dependency discovery can fail because the updater generates a
NuGet.Config
file before the updater is run that contains all of the feeds listed independabot.yml
as well asapi.nuget.org
and if there are multiple remote feeds used with CPM, a warningNU1507
is generated indicating that nopackageSourceMapping
elements were specified inNuGet.Config
.$(TreatWarningsAsErrors)
then kicks in and prevents dependency discovery from happening.Dependency discovery needs to succeed so we inject the command line argument
/p:TreatWarningsAsErrors=false
to override any property that might be set in the project file or imported.props
or.targets
so theNU1507
warning doesn't cause a failure. Note, properties specified on the command line always override even explicitly set properties in the project or imported files.Side note on why
api.nuget.org
is added to the generatedNuGet.Config
that leads to this issue:The default feed of
api.nuget.org
is explicitly added because if the repo doesn't contain aNuGet.Config
file (or if it does and it doesn't specify the<clear />
directive) then they're already opting in to the default feed behavior which meansapi.nuget.org
. It's possible that a developer's local machine manually removedapi.nuget.org
from the user-level file, but there is no way dependabot can know about that scenario and having the fallback toapi.nuget.org
is the default.