-
Notifications
You must be signed in to change notification settings - Fork 387
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
Comments
Note the title of this issue says "old" project system, but this is happening with the new .NET SDK project system. |
@AArnott What do you mean? We use the evaluated value in the new project system. |
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. |
Can you give me a repro? Make note that @onovotny's repro has a extraneous single quotes around the value. |
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> |
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. |
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? |
I'll find or recreate a repro to share in the next day or two. |
Doesn't meet the bar for 15.5; moving out. |
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. |
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. |
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? |
Any idea when this is expected to be fixed? (date?) |
We do not have an ETA at this time. |
Can you please prioritize this. kind of annoying defect. |
This error particularly affects VSTS users using authenticated feeds. |
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? |
Fixed in 15.9. |
@tmeschter Using 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 |
@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. |
Currently the APIs for accessing PackageReference information (that is, the
VSProject4
andPackageReferences
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 theVersion
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.
The text was updated successfully, but these errors were encountered: