Nuget package installation failure

前端 未结 8 1863
一生所求
一生所求 2020-12-20 11:43

When trying to install a package from our newly created private Nuget Feed i get the following error.

Could not install package \'GC.Timecode 1.0.0.3\'. You are tryi

8条回答
  •  渐次进展
    2020-12-20 12:27

    This happened to me and I didn't find my solution posted to any of these sites, so hopefully this helps someone else.

    The message I was getting was:

    Could not install package 'Package Name'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.6.1', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

    I had a Nuget package that was built for all 4.x versions so it shouldn't matter that it didn't specify version 4.6.1 specifically. I tried changing the class library build to 4.0, 4.5, 4.5.2, 4.6, 4.6.1, and 4.6.2 but nothing fixed this problem. I also added multiple versions of the DLL to the package in individual /lib/Net4(5,51,52,6,61,62) folders and the error was still there.

    Eventually, I found out the reason for my problem was the initial private Nuget package I created was a "bad" package and that bad package was cached to my local machine.

    I fixed the package problem and pushed the new package to our Nuget server (leaving the version name the same), but Nuget inside Visual Studio wasn't pulling down the new package but instead referenced the bad package cached on my local machine at. Package Manager showed the package was updated and displayed the information correctly from our Nuget server but it was never fetching the new package. It was always retrieving the cached package at:

    C:\Users\your_user_account\.Nuget\packages\

    Simply deleting the package in question under your local user account forced Package Manager to pull down the new package from the server.

提交回复
热议问题