How to specify a specific folder for a NuGet source package?
I am afraid there is no such way you can specify a project folder location for this package directly. Because this behavior is determined by the internal file structure of the package. If we are not the author/owner of this package, we could not change the internal file structure of the package.
As a workaround, you can download that nuget package and re-pack that package and change the target folder to contentFiles/cs/netstandard2.0/Test/
with the .nuspec
file:
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata minClientVersion="2.12">
<id>Microsoft.Bcl.Json.Sources</id>
<version>4.6.0-preview.19073.11</version>
<title>Microsoft.Bcl.Json.Sources</title>
<authors>Microsoft</authors>
<owners>microsoft,dotnetframework</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<licenseUrl>https://github.com/dotnet/corefx/blob/master/LICENSE.TXT</licenseUrl>
<projectUrl>https://dot.net/</projectUrl>
<iconUrl>http://go.microsoft.com/fwlink/?LinkID=288859</iconUrl>
<description>Add Description Here</description>
<releaseNotes>https://go.microsoft.com/fwlink/?LinkID=799421</releaseNotes>
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
<serviceable>true</serviceable>
<contentFiles>
<files include="cs/netstandard2.0/BitStack.cs" buildAction="content" flatten="true" copyToOutput="true"/>
<files include="cs/netstandard2.0/xx.cs" buildAction="content" flatten="true" copyToOutput="true"/>
...
</contentFiles>
</metadata>
<files>
<file src="build/netstandard2.0/Microsoft.Bcl.Json.Sources.targets" target="build" />
<file src="build/netstandard2.0/Strings.resx" target="build" />
<file src="contentFiles/cs/netstandard2.0/BitStack.cs" target="contentFiles/cs/netstandard2.0/Test/" />
<file src="contentFiles/cs/netstandard2.0/xx.cs" target="contentFiles/cs/netstandard2.0/Test/" />
...
</files>
</package>
Then add this package to your local nuget package feed, then use this your custom nuget package, all those .cs
file are added to the Test
folder:

Hope this helps.