Something not right with nuget package?
Closed this issue · 9 comments
Hi,
I was trying to use the library in another portable library, but if I try and add it from nuget it gives an error...
Could not install package 'Yort.Ntp.Portable 1.0.2'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.0,Profile=Profile158', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
However, I grabbed the source, recompiled and manually added the reference and it seems to be fine.
I don't work with portable stuff much, so it's quite possibly my mistake, but thought I'd raise it?
Thanks,
Adam.
Hi Adam, thanks for letting me know. I'm away at the moment so it will probably be next week before I can look into it sorry. Which version of VS/nuget are you using? I have seen this error on a different package that used the Microsoft.bcl.async dependency... That package didn't work in some project types in VS2015 (worked fine in 2013) if it wasn't the latest version. By default, the dependency isn't the latest version, so that might be the problem.
If you manually install Microsoft.bcl.async then install ntp, does that help?
No problem, I can just work with the manually compiled copy for now. It's VS2015 with nuget v3.3.0.167. I'm not sure what you're saying when you mention that...
By default, the dependency isn't the latest version, so that might be the problem.
Do you mean your nuget package should have a dependency on Microsoft.bcl.async? Because according to nuget you don't have any dependencies.
Ok so I added bcl.async manually, and that gave me a new error (along with the previous one)...
The primary reference "Yort.Ntp" could not be resolved because it was built against the ".NETPortable,Version=v4.5,Profile=Profile111" framework. This is a higher version than the currently targeted framework ".NETPortable,Version=v4.0,Profile=Profile147"
So I thought that seems to be implying that it's only finding a portable version for 4.5+ not 4.0+. So then I tried changing my targeting to 4.5, I removed the manually added bcl.async stuff, and tried adding yort.ntp again. Back to the original error. (I did also then try adding the bcl.async stuff again, but that made no difference.)
So then I did some research into the .NETPortable version strings. You'll find the perfect resource here if you haven't already seen it. You'll see there's some slight weirdness with the version strings, because it's based on the combination of targets, not specifically the versions. For example, Profile 158 targets framework 4.5, but the version string is .NETPortable,Version=v4.0,Profile=Profile158
.
All I can think is that it's something to do with how nuget compares or validates the version strings. Because obvisouly the actual assembly works if I include it manually. Like I said, I don't do portable much, so I'll have to do more research to see if I can help any further, but hopefully that might give you a bit of starter into where the problem might be.
Thanks.
Sorry, I forgot I had chosen not to take a dependency on th bcl async stuff in this project for down level frameworks (no async/await support unless the platform natively has it). The problems I mentioned only occur if those dependencies exist either directly or as dependencies of something else (usually the Microsoft Http Client Library) which doesn't apply in this case.
It probably is just a targeting problem in the nuget package, I'll see what I can do when I get near some tools. Thanks again for reporting it and the analysis.
Hi,
I've pushed a new package to Nuget which I believe fixes the problem. It should be available in 15 minutes. Please try it when you can and let me know if it works your end.
Thanks.
Any luck with the new package?
Sorry, hadn't had a chance to test it. The package did install correctly. I got an error afterwards showing... The type 'EventHandler<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. I allowed resharper to add this reference, but now I don't seem to be able to actually define the event handler. Again this now appears to be something related to the portable stuff. I'll keep analysing. Weirdly this obviously wasn't a problem with the assembly I and-compiled.
Hi,
I've pushed a new package that I believe I have working successfully here with a profile158 PCL. Please try that one and see how you get on.
Thanks.
All fixed!!!! thanks!
👍 Thanks for letting me know.