-
Notifications
You must be signed in to change notification settings - Fork 391
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
contentFiles under "any" folder doesn't work with PackageReference-style with classic csproj #3042
Comments
@jainaashish Can you help us understand how many such packages there are? |
I'm not sure of the numbers, but I would imagine it as a common scenario for ContentFiles since most cases, users aren't sure of {tfm} so they just keep it as But I can try running a script to get this number for you. |
Observed the same issue in well known IOC Performance benchark maintained by @danielpalme. |
@jainaashish I'm not sure this is a dotnet/project-system issue. When using an SDK-based project targeting <ItemGroup Condition=" '$(Language)' == 'C#' AND '$(ExcludeRestorePackageImports)' != 'true' ">
<None Include="$(NuGetPackageRoot)test\1.0.0\contentFiles\cs\any\Test.conf" Condition="Exists('$(NuGetPackageRoot)test\1.0.0\contentFiles\cs\any\Test.conf')">
<NuGetPackageId>Test</NuGetPackageId>
<NuGetPackageVersion>1.0.0</NuGetPackageVersion>
<NuGetItemType>None</NuGetItemType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>Test.conf</TargetPath>
<Private>True</Private>
<Link>Test.conf</Link>
</None>
<None Include="$(NuGetPackageRoot)test\1.0.0\contentFiles\cs\any\Test.txt" Condition="Exists('$(NuGetPackageRoot)test\1.0.0\contentFiles\cs\any\Test.txt')">
<NuGetPackageId>Test</NuGetPackageId>
<NuGetPackageVersion>1.0.0</NuGetPackageVersion>
<NuGetItemType>None</NuGetItemType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>Test.txt</TargetPath>
<Private>True</Private>
<Link>Test.txt</Link>
</None>
<None Include="$(NuGetPackageRoot)test\1.0.0\contentFiles\cs\any\Test2.cs" Condition="Exists('$(NuGetPackageRoot)test\1.0.0\contentFiles\cs\any\Test2.cs')">
<NuGetPackageId>Test</NuGetPackageId>
<NuGetPackageVersion>1.0.0</NuGetPackageVersion>
<NuGetItemType>None</NuGetItemType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>Test2.cs</TargetPath>
<Private>True</Private>
<Link>Test2.cs</Link>
</None>
</ItemGroup> This seems reasonable, and those files are copied to the output as expected. However, when using a csproj-based project targeting 4.6.1 none of these items appear in the .nuget.g.props. However, the "contentFiles\cs\net45\Test.cs" file does end up being copied to the output directory--I assume this is being done by the tasks/targets in NuGet/NuGet.BuildTasks. It gets more confusing. If I update the SDK-based project to target <ItemGroup Condition=" '$(Language)' == 'C#' AND '$(ExcludeRestorePackageImports)' != 'true' ">
<None Include="$(NuGetPackageRoot)test\1.0.0\contentFiles\cs\net45\Test.cs" Condition="Exists('$(NuGetPackageRoot)test\1.0.0\contentFiles\cs\net45\Test.cs')">
<NuGetPackageId>Test</NuGetPackageId>
<NuGetPackageVersion>1.0.0</NuGetPackageVersion>
<NuGetItemType>None</NuGetItemType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>Test.cs</TargetPath>
<Private>True</Private>
<Link>Test.cs</Link>
</None>
</ItemGroup> So when targeting the same framework (4.6.1), the SDK and csproj behavior lines up (though clearly through different mechanisms). A couple of questions:
|
@tmeschter The root of all that evil is somewhere here. I have created an on NuGet's side to follow up on this. |
@nkolev92 this issue isn't about build folder, instead about And to answer @tmeschter questions:
|
Btw, regarding the simplest workaround until this issue is fixed.. In DryIocZero 4 final version I've ended up with readme file popping up on package install, with instruction to copy .tt files manually from package to your project :/ |
Tom's triage notes: likely a straight-forward fix in NuGet/NuGet.BuildTasks. However, I don't have a good sense for how important it is to fix. |
@jainaashish Could you take a look at the PR I've created to fix this and let me know if the behavior seems correct? |
@tmeschter Can you determine what should happen with this bug? |
Copied from NuGet/Home#6287
Details about Problem
Using VS UI/nuget.exe pack
NuGet version in VS: 4.5.0
VS version: 15.5.0
OS version: win10 v1709 (16299.98)
Detailed repro steps so we can see the same problem
Expected:
All the files listed appear in the output directory after building.
Actual:
Only the file in contentFiles\cs\net45 appears in the output directory after building.
Note that the bug does not repro when using a .NET Core project.
Note also that the bug is only for target locations such as:
contentFiles\cs\any
contentFiles\any\any
Things work correctly for targets such as:
contentFiles\cs\net45
Apologies if this is a dup, but I couldn't find this specific issue in a quick search.
Sample Project
repro.zip
The text was updated successfully, but these errors were encountered: