Closed marco-carvalho closed 7 months ago
I created https://github.com/dependabot/dependabot-core/pull/8531 to showcase the error
I managed to make it work after installing this package: https://www.nuget.org/packages/MSBuild.Microsoft.VisualStudio.Web.targets
Edit: And going from this:
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
To this:
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
Now I'm getting this error:
updater | Unhandled exception: System.ArgumentNullException: Value cannot be null. (Parameter 'value')
updater | at System.ArgumentNullException.Throw(String paramName)
updater | at System.ArgumentNullException.ThrowIfNull(Object argument, String paramName)
updater | at System.Xml.Linq.XAttribute..ctor(XName name, Object value)
updater | at NuGet.Runtime.AssemblyBinding.ToXElement()
updater | at NuGetUpdater.Core.BindingRedirectManager.AddBindingRedirects(ConfigurationFile configFile, IEnumerable`1 bindingRedirects) in /opt/nuget/lib/NuGetUpdater/NuGetUpdater.Core/Updater/BindingRedirectManager.cs:line 227
updater | at NuGetUpdater.Core.BindingRedirectManager.UpdateBindingRedirectsAsync(ProjectBuildFile projectBuildFile) in /opt/nuget/lib/NuGetUpdater/NuGetUpdater.Core/Updater/BindingRedirectManager.cs:line 43
updater | at NuGetUpdater.Core.PackagesConfigUpdater.UpdateDependencyAsync(String repoRootPath, String projectPath, String dependencyName, String previousDependencyVersion, String newDependencyVersion, Boolean isTransitive, Logger logger) in /opt/nuget/lib/NuGetUpdater/NuGetUpdater.Core/Updater/PackagesConfigUpdater.cs:line 65
updater | at NuGetUpdater.Core.UpdaterWorker.RunForProjectAsync(String repoRootPath, String projectPath, String dependencyName, String previousDependencyVersion, String newDependencyVersion, Boolean isTransitive) in /opt/nuget/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdaterWorker.cs:line 77
updater | at NuGetUpdater.Core.UpdaterWorker.RunAsync(String repoRootPath, String filePath, String dependencyName, String previousDependencyVersion, String newDependencyVersion, Boolean isTransitive) in /opt/nuget/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdaterWorker.cs:line 42
updater | at NuGetUpdater.Cli.Commands.UpdateCommand.<>c__DisplayClass7_0.<<GetCommand>b__0>d.MoveNext() in /opt/nuget/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/UpdateCommand.cs:line 37
updater | --- End of stack trace from previous location ---
updater | at System.CommandLine.Invocation.AnonymousCommandHandler.InvokeAsync(InvocationContext context)
updater | at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
updater | --- End of stack trace from previous location ---
updater | at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass17_0.<<UseParseErrorReporting>b__0>d.MoveNext()
updater | --- End of stack trace from previous location ---
updater | at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass12_0.<<UseHelp>b__0>d.MoveNext()
updater | --- End of stack trace from previous location ---
updater | at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseVersionOption>b__0>d.MoveNext()
updater | --- End of stack trace from previous location ---
updater | at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass19_0.<<UseTypoCorrections>b__0>d.MoveNext()
updater | --- End of stack trace from previous location ---
updater | at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__18_0>d.MoveNext()
updater | --- End of stack trace from previous location ---
updater | at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<<UseParseDirective>b__0>d.MoveNext()
updater | --- End of stack trace from previous location ---
updater | at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__5_0>d.MoveNext()
updater | --- End of stack trace from previous location ---
updater | at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass8_0.<<UseExceptionHandler>b__0>d.MoveNext()
Thinking out loud here for a minute: adding an extra package seems out-of-scope for the NuGet updater, but that targets file is conditioned on Condition="'$(VSToolsPath)' != ''"
, so perhaps if we can force-unset that variable after MSBuild starts up, we could avoid the issue all together.
Is there an existing issue for this?
Package ecosystem
nuget
Package manager version
No response
Language version
.NET Framework 4.8
Manifest location and content before the Dependabot update
No response
dependabot.yml content
No response
Updated dependency
No response
What you expected to see, versus what you actually saw
My
.csproj
requires to have this:But it's returning this:
Native package manager behavior
No response
Images of the diff or a link to the PR, issue, or logs
No response
Smallest manifest that reproduces the issue
No response