GithubHelp home page GithubHelp logo

cloudnimble / packagereferenceupgrader Goto Github PK

View Code? Open in Web Editor NEW
27.0 27.0 9.0 69 KB

A VS2017 Extension that helps legacy apps migrate off of packages.config.

License: MIT License

C# 100.00%
nuget packages-config visualstudio2017

packagereferenceupgrader's People

Contributors

gregtrevellick avatar robertmclaws avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

packagereferenceupgrader's Issues

Command does not show up in dialog box

Installed product versions

  • Visual Studio: 2017 Professional
  • This extension: 0.1.33

After installing, I expected to see a menu option on the right click dialog for packages.config files, I do not see that. No errors in VStudio, Tried with packagereferences as the default and without.

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

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.

.net compiler imports removed

Installed product versions

  • Visual Studio: 2017 (15.5.0)

Description

The .net compiler import statements are removed - not sure if an issue or not.

snip

The .csproj rewriting is a bit too eager in removing nodes

I wasn't able to build after upgrade because C# targets were removed by your .csproj rewriter:

  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

It looks like this bit of code in NuGetUpgraderPackage.cs:

186    //RWM: Remove any Package Targets. 
187    targets.Where(c => c.Attribute("Project").Value.Contains(row.Attribute("id").Value)).ToList() 
188           .ForEach(c => c.Remove()); 

Older csproj files get 'corrupted'.

Installed product versions

  • Visual Studio: 2017 Enterprise
  • This extension: 1.0.0

Description

Older csproj files get 'corrupted'.

Steps to recreate

  1. open an old csproj (created with VS 2015 or before that)
  2. make the upgrade
  3. have a look at the differences

Current behavior

Before:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
...

After:
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
...

  • the xml header is removed, why?
  • the ToolsVersion is not upgraded -> msbuild 14 or before can not handle <PackageReference Include="..." Version="..." />

Expected behavior

After:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
...

However, IMHO getting into upgrading csproj to VS2017 (ToolsVersion="15.0") might be difficult. Even VS2017 does not handle that entirely correct for old projects (removing/adding/updating tags).

So may be only enable the upgrade for VS2015 (ToolsVersion="15.0") projects?

Project file encoding changed

Installed product versions

  • Visual Studio: 2017 (15.5.0)

Description

The tool changes the encoding which causes problem when diff'ing.

snip

Does not work with VS2022

Installed product versions

  • Visual Studio: Visual Studio Enterprise 2022
  • This extension: 1.0.1

Description

Currently the extension does not work with VS2022, when trying to install the extension the following message is shown:
image

Steps to recreate

Attempt to install with VS2022

Current behavior

Won't install

Expected behavior

Should be able to install and use with VS2022

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.