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

Improve PackageReference support in old project system #2129

Closed
tmeschter opened this issue May 5, 2017 · 20 comments
Closed

Improve PackageReference support in old project system #2129

tmeschter opened this issue May 5, 2017 · 20 comments
Assignees
Labels
Feature-NuGet NuGet integration including pushing it properties, project and package references, and Pack support. Legacy Issues against the legacy project system. Resolution-Fixed The bug has been fixed, refer to the milestone to see in which release it was fixed.
Milestone

Comments

@tmeschter
Copy link
Contributor

Currently the APIs for accessing PackageReference information (that is, the VSProject4 and PackageReferences interfaces) operate more-or-less right on top of the project file's XML. This is limiting in that the PackageReference elements will not have been evaluated; for example, if the Version metadata refers to a property such as $(MyCommonVersion) then what a consumer of these interfaces will see is the literal string "$(MyCommonVersion)" rather than the evaluated value.

We should update these interfaces to work on the evaluated data instead.

@AArnott
Copy link
Contributor

AArnott commented Jul 3, 2017

Note the title of this issue says "old" project system, but this is happening with the new .NET SDK project system.

@davkean
Copy link
Member

davkean commented Jul 3, 2017

@AArnott What do you mean? We use the evaluated value in the new project system.

@AArnott
Copy link
Contributor

AArnott commented Jul 4, 2017

I have solution of only new project system projects, and yet NuGet/Home#5295 (which was closed as a dupe of this one) occurs in these solutions.

@davkean
Copy link
Member

davkean commented Jul 4, 2017

Can you give me a repro? Make note that @onovotny's repro has a extraneous single quotes around the value.

@davkean
Copy link
Member

davkean commented Jul 4, 2017

This works fine:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp1.1</TargetFramework>
    <GiveMeAVersion>9.0.1</GiveMeAVersion>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Newtonsoft.Json" Version="$(GiveMeAVersion)" />
  </ItemGroup>
</Project>

@AArnott
Copy link
Contributor

AArnott commented Jul 4, 2017

Try moving the ref to directory.build.props. Restore is fine, but every time you build in VS or run tests, the error appears in the output window.

@davkean
Copy link
Member

davkean commented Jul 4, 2017

I can still not repro this - I pulled it out into Directory.Build.props, installed xunit, ran tests with zero issue. In the new project system we read all package references using evaluation, so something else must be involved.

Given this is tracking legacy project system support, can you file a new bug with a repro?

@AArnott
Copy link
Contributor

AArnott commented Jul 4, 2017

I'll find or recreate a repro to share in the next day or two.

@tmeschter
Copy link
Contributor Author

Doesn't meet the bar for 15.5; moving out.

@tmeschter tmeschter modified the milestones: 15.5, 15.6 Sep 27, 2017
@AArnott
Copy link
Contributor

AArnott commented Sep 29, 2017

OK, at least with my most recent repro, I see that it disappears when I remove the VSIX project from the solution, so it does indeed seem to be an issue with the old project system.

@AArnott
Copy link
Contributor

AArnott commented Sep 29, 2017

BTW, this blocks running unit tests in affected solutions. It also causes the Solution Restore command to report failure and packages to not be restored.

@mwascher
Copy link

mwascher commented Nov 6, 2017

My team is encountering this issue with the latest version of VS 2017. Due to some of our legacy dependencies, we are unable to migrate our csproj files to use the new .NET SDK format, which I understand doesn't have this issue.

Can we expect a fix for this issue to make it out in 15.6?

@venkatcmsft
Copy link

Any idea when this is expected to be fixed? (date?)

@Pilchie
Copy link
Member

Pilchie commented Nov 8, 2017

We do not have an ETA at this time.

@venkatcmsft
Copy link

Can you please prioritize this. kind of annoying defect.

@Pilchie Pilchie added the Feature-NuGet NuGet integration including pushing it properties, project and package references, and Pack support. label Dec 20, 2017
@Pilchie Pilchie modified the milestones: 15.6, 15.7 Dec 20, 2017
@AmadeusW
Copy link

This error particularly affects VSTS users using authenticated feeds.
Since the (authenticated) IDE restore broken, the only way to restore private packages is to go to a directory that contains CredentialProvider.VSS.exe, and use nuget there, passing in path to my project. This slows down our team's workflow.

@anangaur
Copy link

anangaur commented Feb 20, 2018

We (NuGet team) have been receiving multiple customers (internal Microsoft and external) requests to make this work.

We also want the ecosystem to move forward to start using PackageReference and this seems to be a blocker.

In addition, we are moving towards enabling credential provider support cross plat with dotnet.exe and msbuild.exe and these tools work with PackageReference. Our story will be broken without the variable replacement support.

Is it too late to take this in for 15.6?

@tmeschter
Copy link
Contributor Author

Fixed in 15.9.

@tmeschter tmeschter added the Resolution-Fixed The bug has been fixed, refer to the milestone to see in which release it was fixed. label Sep 11, 2018
@bergmeister
Copy link

bergmeister commented Oct 6, 2018

@tmeschter Using 15.9-preview3, this still happens to me. You can repro by cloning the PowerShell repo here and adding the hosting.csproj to PowerShell.sln. I have done this in my branch here so that you can just repro as follows (in PowerShell):

git clone https://github.com/bergmeister/PowerShell.git PowerShell_bergmeister
cd .\PowerShell_bergmeister
git checkout NuGetBug
Invoke-Item .\PowerShell.sln
# Observe error when building hosting.tests project

NB. I am using the latest .Net SDK v 2.1.402, OS is Windows 10 1809

@tmeschter
Copy link
Contributor Author

@bergmeister This bug concerns missing functionality in VS when working with non-SDK-based projects. If you're seeing errors while building or when using SDK-based projects (and it looks to me like you are) then that is a separate issue.

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. Legacy Issues against the legacy project system. Resolution-Fixed The bug has been fixed, refer to the milestone to see in which release it was fixed.
Projects
None yet
Development

No branches or pull requests