What determines .NET version subfolder and HintPath for a NuGet package and how can we change them?

528 Views Asked by At

I created a custom NuGet package that targets .NET Framework 4.6.2. When I add it to a (also 4.6.2) project in Visual Studio, it creates the correct folder inside packages with my DLL under lib\net462.

However, the behavior is not the same in a TFS vNext build with a NuGet Package Restore step - it places it under lib\net461... HintPath in the .csproj file is still net462 and the build fails as it doesn't find the DLL.

How is the location of a NuGet package determined when installing it? Same question with HintPath? How can I specify them so as to avoid bad surprises during builds?

Config info:

MSBuild\15.0\Bin\msbuild.exe both locally and in the TFS build

Visual Studio 2017 15.8.8

0

There are 0 best solutions below