Vs2017 Migration failed, ArgumentNullException

When migrating a solution from project.json to .csproj, migration is not performed for a single project in the solution.

The given error:

Migration failed. Unhandled Exception: System.ArgumentNullException: Value cannot be null. Parameter name: version at NuGet.Versioning.VersionRangeBase.Satisfies(NuGetVersion version, IVersionComparer comparer)

This error is bewildering, since the project contains 24 other projects, all of which were successfully migrated, all with similar contents of project.json.

This is project.json

 { "version": "1.0.0-*", "dependencies": { "EPPlus": "4.0.5", "Microsoft.AspNetCore.Mvc.Abstractions": "1.0.1", "Microsoft.AspNetCore.Mvc.Core": "1.0.1", "Microsoft.AspNetCore.Mvc.ViewFeatures": "1.0.1", "Microsoft.Azure.DocumentDB": "1.11.1", "Microsoft.EntityFrameworkCore.SqlServer": "1.0.1", "Microsoft.Extensions.Caching.Abstractions": "1.0.0", "Microsoft.Extensions.Caching.Redis": "1.0.0", "Microsoft.Extensions.Configuration.Ini": "1.0.0", "Microsoft.Extensions.Configuration.Json": "1.0.0", "Microsoft.IdentityModel.Clients.ActiveDirectory": "3.13.7", "MongoDB.Driver": "2.3.0", "NETStandard.Library": "1.6.0", "RabbitMQ.Client": "4.1.1", "Sendgrid": "6.3.4", "System.Collections.Immutable": "1.3.0", "System.Runtime": "*", "WindowsAzure.ServiceBus": "3.4.4", "WindowsAzure.Storage": "8.0.1", "Unofficial.Ionic.Zip": "1.9.1.8" }, "frameworks": { "net461": { "frameworkAssemblies": { "System.Drawing": "4.0.0.0" } } } } 

This is a complete error:

  ms.Lib\ms.Lib.xproj: Could not read post-migration report at 'C:\Users\alexl\AppData\Local\Temp\uf3cu05h.ayd'. ms.Lib\ms.Lib.xproj: Failed to migrate XProj project ms.Lib. 'dotnet migrate --skip-backup -s -x "C:\Users\alexl\git\vs2017test\eServices\ms.Lib\ms.Lib.xproj" "C:\Users\alexl\git\vs2017test\eServices\ms.Lib" -r "C:\Users\alexl\AppData\Local\Temp\uf3cu05h.ayd" --format-report-file-json' exited with error code -532462766. ms.Lib\ms.Lib.xproj: Migration failed. Unhandled Exception: System.ArgumentNullException: Value cannot be null. Parameter name: version at NuGet.Versioning.VersionRangeBase.Satisfies(NuGetVersion version, IVersionComparer comparer) at NuGet.Versioning.VersionRangeBase.Satisfies(NuGetVersion version) at Microsoft.DotNet.ProjectJsonMigration.Rules.MigratePackageDependenciesAndToolsRule.<>c__DisplayClass11_0.<ToPackageDependencyInfo>b__2(VersionRange p) at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate) at Microsoft.DotNet.ProjectJsonMigration.Rules.MigratePackageDependenciesAndToolsRule.ToPackageDependencyInfo(ProjectLibraryDependency dependency, IDictionary`2 dependencyToVersionMap) at Microsoft.DotNet.ProjectJsonMigration.Rules.MigratePackageDependenciesAndToolsRule.MigrateDependencies(Project project, MigrationRuleInputs migrationRuleInputs, NuGetFramework framework, IEnumerable`1 dependencies, SlnFile solutionFile, ProjectItemGroupElement itemGroup) at Microsoft.DotNet.ProjectJsonMigration.Rules.MigratePackageDependenciesAndToolsRule.Apply(MigrationSettings migrationSettings, MigrationRuleInputs migrationRuleInputs) at Microsoft.DotNet.ProjectJsonMigration.DefaultMigrationRuleSet.Apply(MigrationSettings migrationSettings, MigrationRuleInputs migrationRuleInputs) at Microsoft.DotNet.ProjectJsonMigration.ProjectMigrator.MigrateProject(MigrationSettings migrationSettings) at Microsoft.DotNet.ProjectJsonMigration.ProjectMigrator.Migrate(MigrationSettings rootSettings, Boolean skipProjectReferences) at Microsoft.DotNet.Tools.Migrate.MigrateCommand.Execute() at Microsoft.DotNet.Tools.Migrate.MigrateCommand.<>c__DisplayClass35_0.<Run>b__0() at Microsoft.DotNet.Cli.CommandLine.CommandLineApplication.Execute(String[] args) at Microsoft.DotNet.Tools.Migrate.MigrateCommand.Run(String[] args) at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, ITelemetry telemetryClient) at Microsoft.DotNet.Cli.Program.Main(String[] args) ms.Lib\ms.Lib.xproj: Backing up C:\Users\alexl\git\vs2017test\eServices\ms.Lib\ms.Lib.xproj to C:\Users\alexl\git\vs2017test\eServices\Backup1\ms.Lib.xproj. ms.Lib\project.json: Backing up C:\Users\alexl\git\vs2017test\eServices\ms.Lib\project.json to C:\Users\alexl\git\vs2017test\eServices\Backup1\project.json. 

Is there anything in the .json project that would explain this error?

+5
source share
1 answer

It turns out that the migration tool is not like "System.Runtime": "*", which does not have an explicit version number. Going to "System.Runtime": "4.0.20", worked.

+7
source

Source: https://habr.com/ru/post/1265233/


All Articles