Closed SergeyKanzhelev closed 6 years ago
Windows Version [10.0.14393]
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?
@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.
@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?
CC: @Dmitry-Matveev
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+
Reopened for now for tracking purpose.
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?
Its because of content
you can have something like any/net45/xyz.xdt
in content folder similar to contentFiles
Although I'm not sure if any/net45
will work similarly there or not so let me just check.
@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.
for content
you can use tfm as a subfolder and put all the files inside that like content/net45
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
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