olsh/dotnet-consolidate

Package references not found

xp-development opened this issue · 5 comments

No package references were found in my csproj files. I debug the code and found two parts that I have to change.

  1. To read XML elements it is necessary to add the namespace:
var ns = "http://schemas.microsoft.com/developer/msbuild/2003";
var packageReferences = xml.Root.Elements(XName.Get("ItemGroup", ns)).Elements(XName.Get("PackageReference", ns));
  1. Version is not an attribute. It is an element in my project files.
var version = reference.Element(XName.Get("Version", ns));
olsh commented

Hi @xp-development ,
Thank you for the info 👍
Could you please provide a demo solution?

olsh commented

Thanks, I'll take a look. 👍

olsh commented

The package reference format was added in the 1.1.0 version.

Feel free to reopen the issue if you still have problems with the solution.

The new package works. Thank you!!