dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.68k stars 1.06k forks source link

Is there a version 4.1.0.0 of System.Xml.ReaderWriter anywhere? #1038

Open weshaggard opened 7 years ago

weshaggard commented 7 years ago

@mattleibow commented on Fri Mar 17 2017

I notice in the v4.3.0 NuGet of System.Xml.ReaderWriter, the netstandard1.3 assembly version is 4.1.0.0. But, no other version is like this, all appear to be version 4.0.10.0... The netcore50 version is 4.0.10.0. Even System.Xml.XDocument, which has a direct dependency on System.Xml.ReaderWriter, references a version 4.0.10.0. (The references of which I speak are the actual assembly references, not NuGet references)

At runtime, I get an exception saying that v4.1 is not found - which is to be expected.

To resolve this, can either reference the v4.0.11 NuGet directly, or set the NetStandardImplicitPackageVersion property to 1.6.0.

The real question is this by design? or is there a problem? I am running the latest stable/RTM version of Windows 10, and if I am having an issue after upgrading my .NET Standard version, there should be others?

My use case was building a new netstandard1.3 assembly (which uses XML) and NuGet, and then reference that NuGet in a UWP app. Nothing fancy, just plain old NuGet. It was working fine when I was targeting project.json and "NETStandard.Library": "1.6.0". So this really has to do with the "implicit" upgrade to v1.6.1 as well.


@karelz commented on Fri Mar 17 2017

@ericstj @weshaggard packaging bug?


@weshaggard commented on Mon Mar 20 2017

@mattleibow what are you targeting? Are you targeting .NET Framework?

There is a 4.1.0.0 version of this library in the nuget package under lib\netstandard1.3\System.Xml.ReaderWriter.dll


@mattleibow commented on Tue Mar 21 2017

@weshaggard I was targeting UWP. I created a new .NET Standard library, and then took that output .dll and added it to my UWP app. I then got that runtime error.


@weshaggard commented on Tue Mar 21 2017

Can you share your project.json file?

As an aside UWP doesn't yet have first class support for the "NETStandard.Library" package. Is there a reason you are trying to consume the latest System.Xml.ReaderWriter library?


@mattleibow commented on Tue Mar 21 2017

I was not trying to support that version particularly, I was just building this project file: https://github.com/mono/SkiaSharp/blob/master/binding/SkiaSharp.NetStandard/SkiaSharp.NetStandard.csproj#L10

If I remove that line (line 10), then it builds against 1.6.1, which has a version ReaderWriter that is not available in a UWP app.

NETStandard.Library v1.6.0 includes the v4.0.11 NuGet (which works) NETStandard.Library v1.6.1 includes the v4.3.0 NuGet (which has the new reference assembly version)


@weshaggard commented on Tue Mar 21 2017

I see so you are building a netstandard1.3 library using the new msbuild tooling just released with VS2017 and then are you trying to consume this via a ProjectReference or are you referencing the nuget package in your UWP application?


@mattleibow commented on Tue Mar 21 2017

I managed to get a test case: https://github.com/mattleibow/UWP-NetStandard-Test

Doesn't do much, except that ClassLibrary1 references:

<PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" />

and then the app (App2) references the dll:

<Reference Include="ClassLibrary1, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">

If I reference the project, via a project reference, then it "works" but this is not what happens when my .dll is in a NuGet.


@mattleibow commented on Tue Mar 21 2017

If I specify the lower NuGet version (v4.0.11) I get this warning:

Detected package downgrade: System.Xml.ReaderWriter from 4.3.0 to 4.0.11 ClassLibrary1 (>= 1.0.0) -> NETStandard.Library (>= 1.6.1) -> System.Xml.ReaderWriter (>= 4.3.0) ClassLibrary1 (>= 1.0.0) -> System.Xml.ReaderWriter (>= 4.0.11)


@weshaggard commented on Tue Mar 21 2017

@srivatsn do you guys support referencing a new standard library project from a UWP project?


@srivatsn commented on Wed Mar 22 2017

Yes referencing from UWP should work.


@mattleibow commented on Wed Mar 22 2017

The actual referencing works, but the System.Xml.ReaderWriter v4.3.0 NuGet has an assembly version that does not appear to exist in the UWP profile: "System.Xml.ReaderWriter.dll,Version=4.1.0.0"


@weshaggard commented on Wed Mar 22 2017

@mattleibow I took a look at your repo (thinks for the minimal project repo). You are correct this isn't fully working it appears as though the package references are not flowing across the ProjectReference so the UWP application isn't merging the package graphs and so it isn't picking up the newer package for System.Xml.ReaderWriter. On top of the workaround you suggested you can also explicitly add "System.Xml.ReaderWriter" 4.3.0 to your UWP project.json file.

@srivatsn @livarcocc where would be the right place to file a tooling issue for this?


@srivatsn commented on Wed Mar 22 2017

I think you can start with https://github.com/dotnet/sdk


@mattleibow commented on Thu Mar 23 2017

@weshaggard Thanks for confirming. For now, I will just build against the older NETStandard.Library. And if I need to use a later version, I can add a netstandard dependency into my .nuspec. That should solve all issues.

weshaggard commented 7 years ago

Just to highlight the issue it appears as though the package dependencies aren't flowing from a .NET Standard project to a UWP project via ProjectReference and as such some dependencies end up getting messed up.

Runaurufu commented 7 years ago

Same issue is for using .NetStandard with "normal" .NetFramework - It is either System.Xml.ReaderWriter (for 1.4) not found or System.Runtime (when using 1.6 Standard) 😞

I am able to make XML related stuff work only if I add nuget package for NETStandard.Library in my .NetFramework project - but this also include all these std references so it is not that pretty...

livarcocc commented 7 years ago

@rrelyea @emgarten can you guys take a look? Is this flow performed by NuGet?

Runaurufu commented 7 years ago

It looks like .NetFramework is looking for .NetStandard dlls. In my understanding .NetFramework should use its own (framework) implementation and not expect .NetStandard dlls to be shipped with .NetStandard library (when referenced as dll and not via NuGet). But maybe I am wrong here and incorrectly assume that this should work just like PCL did? I am puzzled here.

livarcocc commented 6 years ago

@dsplaisted can you take a look?

dsplaisted commented 6 years ago

@mattleibow Is this still an issue? It sounds like it might have been a NuGet bug when a project.json project (the UWP one) references a PackageReference project. It may have been fixed by now.

@Runaurufu The issue you describe sounds like something else than what is described here. If you are still having problems, can you file a new issue with more details and ideally repro steps or a repro project?

Thanks!

Runaurufu commented 6 years ago

@dsplaisted Actually I believe it is kind of resolved now as newer versions of VS actually copy all required dll files when you build application and according to https://github.com/dotnet/standard/issues/514 with .net standard 2.0 and .net 4.7.1 applications will be working even without these additional files (for what I hope). ;p

alikarooni commented 5 years ago

Hello everyone, Anybody has any idea regard this :

Severity Code Description Project File Line Suppression State Suppression State Error CS1705 Assembly 'PresentationFramework' with identity 'PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' uses 'System.Xml.ReaderWriter, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' which has a higher version than referenced assembly 'System.Xml.ReaderWriter' with identity 'System.Xml.ReaderWriter, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' BaseLib C:\Users\alikar\Documents\Git\ricochet\ATC\Source\Libraries\BaseLib\CSC 1 Active

My project targets .netstandard2.1. Feel free to ask any question.

thanks

dsplaisted commented 5 years ago

@alikarooni Please file a new issue for the error you're hitting. If possible, please provide a .binlog of the failing build. Otherwise a repro project will be very helpful.

ericstj commented 5 years ago

My project targets .netstandard2.1.

How are you using PresentationFramework from a netstandard2.1 project? WPF is not supported on netstandard, only netcoreapp3.0. I agree with @dsplaisted that a binlog should help demonstrate what's going on, alternatively an isolated repro.