Home: Argument exception thrown with .net core 3.0 sdk

Created on 27 Sep 2019  路  7Comments  路  Source: NuGet/Home

Please read the following information before posting the issue.

Before posting the issue...

Remove the content above here and fill out details below.

Details about Problem

NuGet product used (NuGet.exe | VS UI | Package Manager Console | dotnet.exe): dotnetcli

NuGet version (x.x.x.xxx): whatever .net is using.

dotnet.exe --version (if appropriate): 3.0.100

VS version (if appropriate): n/a

OS version (i.e. win10 v1607 (14393.321)): macOS and linux container

Worked before? If so, with which NuGet version: the 2.1.802 sdk and preview9

Detailed repro steps so we can see the same problem

  1. Trying to restore fails with an argument exception
     1>Done executing task "MsBuild".
     1>Done building target "_GenerateRestoreGraph" in project "CoreLibraries.sln".
     1>Target "Restore" in file "/usr/local/share/dotnet/sdk/3.0.100/NuGet.targets" from project "/Users/daniel.white/Builds/platform-services/CoreLibraries/CoreLibraries.sln" (entry point):
       Task "RemoveDuplicates"
       Done executing task "RemoveDuplicates".
       Using "RestoreTask" task from assembly "/usr/local/share/dotnet/sdk/3.0.100/NuGet.Build.Tasks.dll".
       Task "RestoreTask"
         (in) RestoreGraphItems Count '535'
         (in) RestoreDisableParallel 'False'
         (in) RestoreNoCache 'False'
         (in) RestoreIgnoreFailedSources 'False'
         (in) RestoreRecursive 'True'
         (in) RestoreForce 'False'
         (in) HideWarningsAndErrors 'False'
         (in) RestoreForceEvaluate 'False'
     1>/usr/local/share/dotnet/sdk/3.0.100/NuGet.targets(123,5): error : Value cannot be null. (Parameter 'folderName') [/Users/daniel.white/Builds/platform-services/CoreLibraries/CoreLibraries.sln]
         System.ArgumentNullException: Value cannot be null. (Parameter 'folderName')
            at NuGet.Frameworks.NuGetFramework.Parse(String folderName, IFrameworkNameProvider mappings)
            at NuGet.Frameworks.NuGetFramework.Parse(String folderName)
            at NuGet.Commands.MSBuildRestoreUtility.AddTargetFrameworkSpecificProperties(PackageSpec spec, IEnumerable`1 items)
            at NuGet.Commands.MSBuildRestoreUtility.GetPackageSpec(IEnumerable`1 items)
            at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
            at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
            at NuGet.Commands.MSBuildRestoreUtility.GetDependencySpec(IEnumerable`1 items)
            at NuGet.Build.Tasks.RestoreTask.ExecuteAsync(ILogger log)
       Done executing task "RestoreTask" -- FAILED.
     1>Done building target "Restore" in project "CoreLibraries.sln" -- FAILED.
     1>Done Building Project "/Users/daniel.white/Builds/platform-services/CoreLibraries/CoreLibraries.sln" (Restore target(s)) -- FAILED.

Build FAILED.

       "/Users/daniel.white/Builds/platform-services/CoreLibraries/CoreLibraries.sln" (Restore target) (1) ->
       (Restore target) -> 
         /usr/local/share/dotnet/sdk/3.0.100/NuGet.targets(123,5): error : Value cannot be null. (Parameter 'folderName') [/Users/daniel.white/Builds/platform-services/CoreLibraries/CoreLibraries.sln]

    0 Warning(s)
    1 Error(s)

I'm not sure where I'm going wrong with this. Any hints?

ErrorHandling Restore NeedsMoreInfo

Most helpful comment

You can hit this error when you remove TargetFramework from project file. I'm not sure if it is case of author of this issue.

All 7 comments

Using /Library/Frameworks/Mono.framework/Versions/6.4.0/lib/mono/msbuild/15.0/bin with nuget restore works, but i prefer the .net cli method

It appears I was missing a root props (in my repo) file. perhaps this error needs caught before hand with a better exception.

Can u give more details on what property (or props) was missing?

How can we best repro this problem?

You can hit this error when you remove TargetFramework from project file. I'm not sure if it is case of author of this issue.

You can hit this error when you remove TargetFramework from project file. I'm not sure if it is case of author of this issue.

Did you ever find a workaround for this or did you just re-add the ?

It seems to work sometimes, if we land on the correct build server.

@aik-jahoda iirc thats what was happening.

I ran into this when my XML was malformed:

<!-- note the missing 's' in the closing tag -->
<RuntimeIdentifiers>win-x64;linux-x64;osx-x64</RuntimeIdentifier> 
Was this page helpful?
0 / 5 - 0 ratings