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

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

Comments

Projects
None yet
7 participants
@dcorriveau-omniscient
Contributor

dcorriveau-omniscient commented Feb 3, 2016

Related to changes in fsprojects/Paket#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

This comment has been minimized.

Show comment
Hide comment
@forki

forki Feb 4, 2016

Member

But the message is correct in this case, right?

Member

forki commented Feb 4, 2016

But the message is correct in this case, right?

@dcorriveau-omniscient

This comment has been minimized.

Show comment
Hide comment
@dcorriveau-omniscient

dcorriveau-omniscient Feb 4, 2016

Contributor

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.

Contributor

dcorriveau-omniscient commented Feb 4, 2016

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

This comment has been minimized.

Show comment
Hide comment
@dcorriveau-omniscient

This comment has been minimized.

Show comment
Hide comment
@dcorriveau-omniscient

dcorriveau-omniscient Feb 4, 2016

Contributor

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

Contributor

dcorriveau-omniscient commented Feb 4, 2016

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

This comment has been minimized.

Show comment
Hide comment
@forki

forki Feb 4, 2016

Member

ouch. that's clearly a bug ;-)

Member

forki commented Feb 4, 2016

ouch. that's clearly a bug ;-)

@forki

This comment has been minimized.

Show comment
Hide comment
@forki

forki Feb 4, 2016

Member

please retry

Member

forki commented Feb 4, 2016

please retry

@matthid

This comment has been minimized.

Show comment
Hide comment
@matthid

matthid Feb 4, 2016

Member

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)

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

This comment has been minimized.

Show comment
Hide comment
@forki

forki Feb 4, 2016

Member

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

Member

forki commented Feb 4, 2016

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

@matthid

This comment has been minimized.

Show comment
Hide comment
@matthid

matthid Feb 4, 2016

Member

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.

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

This comment has been minimized.

Show comment
Hide comment
@forki

forki Feb 4, 2016

Member

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).

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

This comment has been minimized.

Show comment
Hide comment
@dcorriveau-omniscient

dcorriveau-omniscient Feb 4, 2016

Contributor

please retry

Same thing :(

Contributor

dcorriveau-omniscient commented Feb 4, 2016

please retry

Same thing :(

@forki

This comment has been minimized.

Show comment
Hide comment
@forki

forki Feb 4, 2016

Member

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).

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

This comment has been minimized.

Show comment
Hide comment
@dcorriveau-omniscient

dcorriveau-omniscient Feb 4, 2016

Contributor

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

Contributor

dcorriveau-omniscient commented Feb 4, 2016

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

@forki

This comment has been minimized.

Show comment
Hide comment
@forki

forki Feb 5, 2016

Member

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).

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

This comment has been minimized.

Show comment
Hide comment
@dcorriveau-omniscient

dcorriveau-omniscient Feb 5, 2016

Contributor

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.

Contributor

dcorriveau-omniscient commented Feb 5, 2016

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.

@forki forki added the needs-repro label Mar 2, 2016

@davidschwegler

This comment has been minimized.

Show comment
Hide comment
@davidschwegler

davidschwegler Apr 25, 2016

Contributor

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?

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

This comment has been minimized.

Show comment
Hide comment
@forki

forki Apr 27, 2016

Member

@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?

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

This comment has been minimized.

Show comment
Hide comment
@smoothdeveloper

smoothdeveloper Apr 27, 2016

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.

Contributor

smoothdeveloper commented Apr 27, 2016

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

This comment has been minimized.

Show comment
Hide comment
@MovGP0

MovGP0 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

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