NuGet / Home

Repo for NuGet Client issues
Other
1.5k stars 252 forks source link

New Pack can build packages with dependencygroups, which don't work well in NuGet 2.12 (vs 2013) #6268

Closed SergeyKanzhelev closed 6 years ago

SergeyKanzhelev commented 6 years ago

Details about Problem

NuGet product used (NuGet.exe | VS UI | Package Manager Console | dotnet.exe):

VS 2013 Update 5, Package Manager 2.12.0.817 image

NuGet version (x.x.x.xxx): whatever NuGet Package Manager uses?

VS version (if appropriate): VS 2013 Update 5

OS version (i.e. win10 v1607 (14393.321)):

Worked before? If so, with which NuGet version: Different version of the package works there.

Detailed repro steps so we can see the same problem

  1. Package compiled using nuspec shows dependencies

image

  1. Package compiled using new project type doesn't. You can find compiled NuGet here

image

Hubert-Cheng commented 6 years ago

Windows Version [10.0.14393]

SergeyKanzhelev commented 6 years ago

Small update here. It seems that the problem is the target framework of the project. Somehow NuGet allows to install the package that only has something for 4.5+ on project that targets FW 4.0. There is no complains or errors. It simply do not set any references.

Is it expected behavior? Can we somehow block installation on FW 4.0 that is not supported?

jainaashish commented 6 years ago

@SergeyKanzhelev New package format type is not supported with Visual Studio 2013 and NuGet 2.12. It's only supported with Visual Studio 2017 and NuGet 4.x So please upgrade your Visual Studio to take advantage of the new format type.

SergeyKanzhelev commented 6 years ago

@jainaashish so you are saying that we SHOULD NOT build our packages using new approach if we have customers consuming them from VS 2013? Is it also by design?

SergeyKanzhelev commented 6 years ago

CC: @Dmitry-Matveev

jainaashish commented 6 years ago

ohh sorry, if it's only about consuming that package, then it should have shown those dependencies. But I'm afraid if we can do anything for VS 2013. So I'll suggest that you can try packing your project with an explicit .nuspec file where you can include these dependencies without target framework group.

About the target framework, then the reason it allows to install this package on either net45 or net40 without errors or warning because package has some content files which makes it compatible with net40 but it only include library for net45 which is why reference is only added for net45+.

If you remove content files then this package will block installation on net40 or less since it will only have library assets which is net45+

jainaashish commented 6 years ago

Reopened for now for tracking purpose.

SergeyKanzhelev commented 6 years ago

if it's only about consuming that package, then it should have shown those dependencies

It should be fine for me if it doesn't show dependencies. As long as installation blocked...

About the target framework, then the reason it allows to install this package on either net45 or net40 without errors or warning because package has some content files which makes it compatible with net40 but it only include library for net45 which is why reference is only added for net45+.

@jainaashish can I target content files to net45 only? How to do it using csproj file approach? Is it because of content folder or contentFiles folder?

jainaashish commented 6 years ago

Its because of content you can have something like any/net45/xyz.xdt in content folder similar to contentFiles

jainaashish commented 6 years ago

Although I'm not sure if any/net45 will work similarly there or not so let me just check.

SergeyKanzhelev commented 6 years ago

@jainaashish so any recommendations how to change our project file so resulting NuGet will not be installable on net40 projects? Now I see that contentFiles folder created mentioned subfolder, when content folder did not.

BTW, this behavior report on last versions of Visual Studio as well.

jainaashish commented 6 years ago

for content you can use tfm as a subfolder and put all the files inside that like content/net45