Skip to content
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

The nomination doesn't contain privateAssets=all for the netcoreapp package in test projects. #3493

Closed
nkolev92 opened this issue Apr 26, 2018 · 7 comments
Labels
Feature-NuGet NuGet integration including pushing it properties, project and package references, and Pack support. Resolution-No-Repro We cannot reproduce the bug. We need more information, clearer repro steps or a sample project.

Comments

@nkolev92
Copy link
Contributor

nkolev92 commented Apr 26, 2018

  1. Set $env:PROJECTSYSTEM_PROJECTOUTPUTPANEENABLED=1 and launch VS.
  2. Create a C# xUnit Test Project (.NET Core) project.
  3. Look at the nomination data:

Package References
               xunit.runner.visualstudio -- (Description: | RuntimeIdentifier: | NoWarn: | OriginalItemSpec: | FrameworkName: | Version:2.3.1 | Visible: | TargetFramework: | IncludeAssets: | PrivateAssets: | ExcludeAssets: | IsImplicitlyDefined: | FrameworkVersion: | Name: | Type: | Path:)
               xunit -- (Description: | RuntimeIdentifier: | NoWarn: | OriginalItemSpec: | FrameworkName: | Version:2.3.1 | Visible: | TargetFramework: | IncludeAssets: | PrivateAssets: | ExcludeAssets: | IsImplicitlyDefined: | FrameworkVersion: | Name: | Type: | Path:)
               Microsoft.NETCore.App -- (Description: | RuntimeIdentifier: | NoWarn: | OriginalItemSpec: | FrameworkName: | Version:2.0 | Visible: | TargetFramework: | IncludeAssets: | PrivateAssets: | ExcludeAssets: | IsImplicitlyDefined:true | FrameworkVersion: | Name: | Type: | Path:)
               Microsoft.NET.Test.Sdk -- (Description: | RuntimeIdentifier: | NoWarn: | OriginalItemSpec: | FrameworkName: | Version:15.7.0 | Visible: | TargetFramework: | IncludeAssets: | PrivateAssets: | ExcludeAssets: | IsImplicitlyDefined: | FrameworkVersion: | Name: | Type: | Path:)

Note that private assets is normally set to All for Microsoft.NETCore.App, but it's not in this nomination.

To see the difference, do a commandline restore and look at the project spec at the bottom of the assets file.

"Microsoft.NETCore.App": {
              "suppressParent": "All",
              "target": "Package",
              "version": "[2.0.0, )",
              "autoReferenced": true

This doesn't repro in non-test projects.

Attached a pp.txt, I did not find any of the privateassets values being removed in any of the imports.

pp.txt

If a set a value manually to any of the other package reference, that specific reference gets correctly nominated.

Related to NuGet/Home#6772

@Pilchie Pilchie added Feature-NuGet NuGet integration including pushing it properties, project and package references, and Pack support. Area-New-Project-System labels Apr 27, 2018
@Pilchie Pilchie added this to the 15.8 milestone Apr 27, 2018
@Pilchie
Copy link
Member

Pilchie commented Apr 27, 2018

@nkolev92 Can you describe the user impact of this issue?

@nkolev92
Copy link
Contributor Author

Extra restores in Visual Studio after a restore had happened on the commandline.
Since these projects are not packable by default and people don't normally try to take dependencies on test projects, it shouldn't have too many other side effects.

The thing that makes it worth fixing (rather investigating initially) is that there might be different manifestations of the same root cause that we haven't been able to understand or reproduce yet.

jaredpar added a commit to VsVim/VsVim that referenced this issue May 2, 2018
The use of PrivateAssets in an attribute causes a restore difference in the
VS IDE and the command line. The IDE restore will ignore the PrivateAssets
element and flow it to dependent projects. Moving to an element avoids this
problem.

           NuGet/Home#6367
           dotnet/project-system#3493
@jmarolf
Copy link
Contributor

jmarolf commented May 26, 2018

PrivateAssets is set to All in the latest Vs build

Microsoft.NETCore.App -- (Description: | RuntimeIdentifier: | NoWarn: | OriginalItemSpec: | FrameworkName: | Version:2.0 | Visible: | TargetFramework: | IncludeAssets: | PrivateAssets:All | ExcludeAssets: | IsImplicitlyDefined:true | FrameworkVersion: | Name: | Type: | Path:)

However "suppressParent": "All", is still not set in project.assets.json

"Microsoft.NETCore.App": {
  "target": "Package",
  "version": "[2.0.0, )",
  "autoReferenced": true
},

@davkean
Copy link
Member

davkean commented May 28, 2018

Are you saying that we're passing the right value to NuGet?

@nkolev92
Copy link
Contributor Author

@jmarolf
I don't see that in 27726.0.d15.8 - the latest internal preview.

Note that I have seen this for xunit .net core projects only.

What you're articulating could be an additional NuGet issue, I'd love a repro if you have one.

@Pilchie Pilchie modified the milestones: 15.8, 16.0 Jul 3, 2018
@jjmew jjmew modified the milestones: 16.0, 16.X Feb 13, 2019
@davkean
Copy link
Member

davkean commented Feb 7, 2020

I cannot repro this - while Microsoft.NETCore.App has been moved to FrameworkReference, I tried with xUnit and its correctly being passsed through:

    MSBuildProjectExtensionsPath:     C:\Users\davkean\source\repos\XUnitTestProject2\XUnitTestProject2\obj\
    OriginalTargetFrameworks:         
    Target Frameworks (1)
        .NETCoreApp,Version=v3.1
            Framework References
                Microsoft.NETCore.App -- (PrivateAssets:All)
            Package Downloads
            Project References
            Package References
                xunit.runner.visualstudio -- (NoWarn: | GeneratePathProperty: | Version:2.4.0 | Visible: | IncludeAssets: | PrivateAssets: | ExcludeAssets: | IsImplicitlyDefined:)
                coverlet.collector -- (NoWarn: | GeneratePathProperty: | Version:1.0.1 | Visible: | IncludeAssets: | PrivateAssets: | ExcludeAssets: | IsImplicitlyDefined:)
                xunit -- (NoWarn: | GeneratePathProperty: | Version:2.4.0 | Visible: | IncludeAssets: | PrivateAssets:All | ExcludeAssets: | IsImplicitlyDefined:)
                Microsoft.NET.Test.Sdk -- (NoWarn: | GeneratePathProperty: | Version:16.2.0 | Visible: | IncludeAssets: | PrivateAssets: | ExcludeAssets: | IsImplicitlyDefined:)
            Target Framework Properties -- (RestoreLockedMode: | RestorePackagesWithLockFile: | RestoreAdditionalProjectFallbackFolders:;C:\Program Files\dotnet\sdk\3.1.200-preview-014883\Sdks\Microsoft.NET.Sdk\targets\..\..\..\..\NuGetFallbackFolder | RestorePackagesPath: | MSBuildProjectDirectory:C:\Users\davkean\source\repos\XUnitTestProject2\XUnitTestProject2 | RestoreAdditionalProjectSources: | PackageId:XUnitTestProject2 | RuntimeIdentifier: | NoWarn:1701;1702 | RestoreAdditionalProjectFallbackFoldersExcludes: | TargetFrameworkIdentifier:.NETCoreApp | VersionSuffix: | DotnetCliToolTargetFramework:netcoreapp2.2 | VersionPrefix:1.0.0 | Version:1.0.0 | RestoreFallbackFolders: | MSBuildProjectFile:XUnitTestProject2.csproj | TargetFrameworkMoniker:.NETCoreApp,Version=v3.1 | EmitAssetsLogMessages:true | TargetFramework:netcoreapp3.1 | PackageTargetFallback: | ProjectAssetsFile:C:\Users\davkean\source\repos\XUnitTestProject2\XUnitTestProject2\obj\project.assets.json | TreatWarningsAsErrors:false | TargetFrameworkProfile: | RestoreSources: | TargetFrameworks: | NuGetTargetMoniker:.NETCoreApp,Version=v3.1 | RuntimeIdentifierGraphPath:C:\Program Files\dotnet\sdk\3.1.200-preview-014883\RuntimeIdentifierGraph.json | MSBuildProjectExtensionsPath:C:\Users\davkean\source\repos\XUnitTestProject2\XUnitTestProject2\obj\ | TargetFrameworkVersion:v3.1 | NuGetLockFilePath: | RuntimeIdentifiers: | PackageVersion:1.0.0 | WarningsAsErrors:NU1605 | AssetTargetFallback:;net461;net462;net47;net471;net472;net48)
    Tool References

@davkean davkean closed this as completed Feb 7, 2020
@davkean davkean added the Resolution-No-Repro We cannot reproduce the bug. We need more information, clearer repro steps or a sample project. label Feb 7, 2020
@nkolev92
Copy link
Contributor Author

nkolev92 commented Feb 7, 2020

Think the difference was whether it was PrivateAssets attribute vs Element.

    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0">
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>
    <PackageReference Include="xunit" Version="2.4.0" PrivateAssets="all" />

Seems to be fixed now, I can't repro it either.

@drewnoakes drewnoakes removed the Bug label Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature-NuGet NuGet integration including pushing it properties, project and package references, and Pack support. Resolution-No-Repro We cannot reproduce the bug. We need more information, clearer repro steps or a sample project.
Projects
None yet
Development

No branches or pull requests

6 participants