fsprojects / Paket

A dependency manager for .NET with support for NuGet packages and Git repositories.
https://fsprojects.github.io/Paket/
MIT License
2.02k stars 520 forks source link

Don't display unnecessary warning if no target framework is defined #1455

Open dcorriveau-omniscient opened 8 years ago

dcorriveau-omniscient commented 8 years ago

Related to changes in fsprojects/Paket/issues/1442 The warning seems to display even when it shouldn't, we might need to be more restrictive about it. X contains libraries, but not for the selected TargetFramework net452 in project Y

For example, I have a solution with projects that target net452, and I don't define any version or framework requirements in the dependencies file. I still get tons of warning for libraries such as Microsoft.CSharp, Microsoft.Net.Http or System.Net.Http.

forki commented 8 years ago

But the message is correct in this case, right?

dcorriveau-omniscient commented 8 years ago

I don't know what's the right solution for this. But I do know that I don't want tons of warnings in the output window as soon as I add a reference like EntityFramework. At the same time we want the warnings when VS is failing to import dependent assemblies when there is a framework mismatch.

forki commented 8 years ago

what happens when you enable http://fsprojects.github.io/Paket/dependencies-file.html#Automatic-framework-detection ?

dcorriveau-omniscient commented 8 years ago

When I paket update I get the error Could not detect target framework for project x.csproj and it stops the process

Edit: That x.csproj in actually located in \packages\System.Net.FtpClient\source\System.Net.FtpClient.csproj

forki commented 8 years ago

ouch. that's clearly a bug ;-)

forki commented 8 years ago

please retry

matthid commented 8 years ago

I get a warning when paket update on FSharp.Formatting

Package Microsoft.AspNet.Razor contains libraries, but not for the selected TargetFramework net40 in project C:\PROJ\FSharp.Formatting\tests\FSharp.MetadataFormat.Tests\files\crefLib\crefLib1.fsproj.

The point is that the project is not even referencing the package. I think this is related to the fact that paket chooses the paket.references from the upper directory. Until now we never cared (besides some additional references nothing happened), but now we get several warnings.

Maybe its time to add an empty paket.references file. (This is just to let others know if they stumble over this issue for the same reason)

forki commented 8 years ago

I think non-existing paket.references is same as empty file. So the issue is elsewhere

matthid commented 8 years ago

I'm pretty sure it's not: Paket searches up the directories until it finds a paket.references file and uses that. (If you say this is a bug that would be nice, because I never liked that behavior anyway; but this is a (possibly huge) breaking change). Paket does this for quite some time now.

forki commented 8 years ago

Ah you are right. That was a drunk decision :-) On Feb 4, 2016 20:46, "Matthias Dittrich" notifications@github.com wrote:

I'm pretty sure it's not: Paket searches up the directories until it finds a paket.references file and uses that. (If you say this is a bug that would be nice, because I never liked that behavior anyway; but this is a (possibly huge) breaking change). Paket does this for quite some time now.

— Reply to this email directly or view it on GitHub https://github.com/fsprojects/Paket/issues/1455#issuecomment-180020161.

dcorriveau-omniscient commented 8 years ago

please retry

Same thing :(

forki commented 8 years ago

Yeah. Damn it. I can't reproduce it. On Feb 4, 2016 21:34, "dcorriveau-omniscient" notifications@github.com wrote:

please retry

Same thing :(

— Reply to this email directly or view it on GitHub https://github.com/fsprojects/Paket/issues/1455#issuecomment-180034788.

dcorriveau-omniscient commented 8 years ago

Did you try with a reference to System.Net.FtpClient ?

forki commented 8 years ago

Yes. But it doesn't pick the csproj up. Need to investigate deeper. Or can you give me a mini repro? I know this is far away from the original issue ;-) On Feb 4, 2016 21:55, "dcorriveau-omniscient" notifications@github.com wrote:

Did you try with a reference to System.Net.FtpClient ?

— Reply to this email directly or view it on GitHub https://github.com/fsprojects/Paket/issues/1455#issuecomment-180043150.

dcorriveau-omniscient commented 8 years ago

I think you need more than my project, it seems to be tied to the fact that I'm using custom packages from my private nuget server that are built using the "project" type with paket, and those are referencing System.Net.FtpClient.

davidschwegler commented 8 years ago

This discussion is already a bit scattered, but this seems like the best place to discuss it, and I'm experiencing an issue ~~

I get pages of errors like these even though my project is fine, making the output really hard to read and potentially hiding bugs: Package Newtonsoft.Json contains libraries, but not for the selected TargetFramework net45 in project C:\Code\MyProject\src\MyProject.Core\MyProject.Core.csproj.

My paket.dependencies file has something like

framework: portable-net45+win, MonoAndroid, XamariniOS
...
nuget Newtonsoft.Json 6.0.8.3
...

In our portable projects' csproj files, the TargetFrameworkVersion gets set as v4.5, TargetFrameworkProfile Profile7, and TargetFrameworkIdentifier .NETPortable.

To reduce the choose elements in our csproj, I'm setting the framework explicitly in the paket.references file to Newtonsoft.Json framework: portable-net45+win

If I understand this Warning's code correctly, it's checking that the csproj has set TargetFrameworkVersion to v4.5, and then because I'm excluding that framework in paket.references, it thinks it can't include it, and so it incorrectly logs the warning..

Is this a bug, or a misunderstanding on my part?

forki commented 8 years ago

@davidschwegler I think that is an edge case we don't cover yet. Can you create a minimal repro with the settings you described an put it into a zip or something?

smoothdeveloper commented 8 years ago

BTW, I'm noticing this on transitive dependencies that don't apply for the target framework. I get this via Zlib.Portable pulled by FSharp.Data.

Will put a integration test if I have a chance.

MovGP0 commented 7 years ago

a warning when a library for a given target framework is missing is fine.

the bigger issue is that the warning is not providing enough information to fix the issue. it would be helpful to know which target frameworks are supported by a given nuget package, so those should be listed.

instead of:

Package Serilog contains libraries, but not for the selected TargetFramework net40-full in project C:\Users\..\XYZ.csproj.

it should write something like:

Package Serilog contains libraries, but not for the selected TargetFramework net40-full 
    in project C:\Users\..\XYZ.csproj
    available TargetFrameworks are net45, net46
    contact the library author to provide additional targets