Skip to content

Can't upgrade packages.config file in VB.Net projects #9

@zifr

Description

@zifr

Installed product versions

  • Visual Studio: 2017 Enterprise
  • This extension: 1.0.1

Description

In a .sln file, I have a couple VB.Net projects (of type Class Library). Each references one or more NuGet packages, and under each project root is the packages.config file. The tool fails to upgrade any of the packages.config files. I've attached pasted the contents of one of the packages.config that the tool was failing on.

Steps to recreate

  1. Open solution containing several VB.Net projects.
  2. In the solution explorer, click on one of the projects
  3. On the toolbar click Project > Show all files
  4. Back in the solution explorer, find the packages.config under the project we clicked in step 2.
  5. Right click on "packages.config" > Upgrade to PackageReferences

Current behavior

In the output pane, the tool logs that the current packages.config was backed up then, on the very next step, it outputs that a null reference exception occurred. Pasted below is the full output.

Output

1/18/2018 18:16:31: Backup created for C:\[redacted]\packages.config.
1/18/2018 18:16:31: Update failed. Exceptions:
1/18/2018 18:16:31: Message: Object reference not set to an instance of an object.
   at CloudNimble.PackageReferenceUpgrader.NuGetUpgraderPackage.<>c__DisplayClass9_1.<UpgradePackagesConfig>b__12(XElement c) in C:\projects\packagereferenceupgrader\src\CloudNimble.PackageReferenceUpgrader\NuGetUpgraderPackage.cs:line 187
   at System.Linq.Enumerable.<>c__DisplayClass6_0`1.<CombinePredicates>b__0(TSource x)
   at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at CloudNimble.PackageReferenceUpgrader.NuGetUpgraderPackage.<>c__DisplayClass9_0.<UpgradePackagesConfig>b__1(Int32 i) in C:\projects\packagereferenceupgrader\src\CloudNimble.PackageReferenceUpgrader\NuGetUpgraderPackage.cs:line 187
   at System.Threading.Tasks.Parallel.<>c__DisplayClass17_0`1.<ForWorker>b__1()
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)
   at System.Threading.Tasks.Task.<>c__DisplayClass176_0.<ExecuteSelfReplicating>b__0(Object )

packages.config

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Microsoft.Azure.KeyVault.Core" version="2.0.4" targetFramework="net47" />
  <package id="Microsoft.Data.Edm" version="5.8.2" targetFramework="net47" />
  <package id="Microsoft.Data.OData" version="5.8.2" targetFramework="net47" />
  <package id="Microsoft.Data.Services.Client" version="5.8.2" targetFramework="net47" />
  <package id="Newtonsoft.Json" version="9.0.1" targetFramework="net47" />
  <package id="System.ComponentModel.EventBasedAsync" version="4.3.0" targetFramework="net47" />
  <package id="System.Dynamic.Runtime" version="4.3.0" targetFramework="net47" />
  <package id="System.Linq.Queryable" version="4.3.0" targetFramework="net47" />
  <package id="System.Net.Requests" version="4.3.0" targetFramework="net47" />
  <package id="System.Spatial" version="5.8.2" targetFramework="net47" />
  <package id="WindowsAzure.Storage" version="8.0.1" targetFramework="net47" />
</packages>

Expected behavior

Convert the items within the packages.config file to PackageReferences within the .vbproj file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions