Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
dcorriveau-omniscient opened this issue Feb 3, 2016 · 19 comments

Comments

@dcorriveau-omniscient
Copy link
Contributor

Related to changes in /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
Copy link
Member

forki commented Feb 4, 2016

But the message is correct in this case, right?

@dcorriveau-omniscient
Copy link
Contributor Author

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
Copy link
Member

forki commented Feb 4, 2016

@dcorriveau-omniscient
Copy link
Contributor Author

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
Copy link
Member

forki commented Feb 4, 2016

ouch. that's clearly a bug ;-)

@forki
Copy link
Member

forki commented Feb 4, 2016

please retry

@matthid
Copy link
Member

matthid commented Feb 4, 2016

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
Copy link
Member

forki commented Feb 4, 2016

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

@matthid
Copy link
Member

matthid commented Feb 4, 2016

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
Copy link
Member

forki commented Feb 4, 2016

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
#1455 (comment).

@dcorriveau-omniscient
Copy link
Contributor Author

please retry

Same thing :(

@forki
Copy link
Member

forki commented Feb 4, 2016

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
#1455 (comment).

@dcorriveau-omniscient
Copy link
Contributor Author

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

@forki
Copy link
Member

forki commented Feb 5, 2016

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
#1455 (comment).

@dcorriveau-omniscient
Copy link
Contributor Author

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
Copy link
Contributor

davidschwegler commented Apr 25, 2016

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
Copy link
Member

forki commented Apr 27, 2016

@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
Copy link
Contributor

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
Copy link

MovGP0 commented Apr 13, 2017

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

@enricosada enricosada added the bug label Jan 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants