question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Automatic project/NuGet reference resolution with new proj files?

See original GitHub issue

TL;DR:

I used to be able to reference a package and, depending on build environment (global.json with all of the project’s references present and referred to therein / just the project standalone), have it resolve as the local project or a NuGet package. Was this a casualty of the move back to msbuild?

Steps to reproduce

  1. Have a project.json referencing a package by name
  2. Demonstrate that if project is built with project in the context of a larger global.json containing both projects, the local project version is used
  3. Demonstrate that if the project is built in isolation, the reference will be resolved via NuGet
  4. dotnet migrate
  5. Build in situations from 2 and 3 again

Expected behavior

  • When referenced project present, resolved locally
  • When referenced project not present, resolved from NuGet

Actual behavior

  • Explicit ProjectReference OR PackageReference nodes generated in proj file

Environment data

dotnet --info output:

.NET Command Line Tools (1.0.2)

Product Information:
 Version:            1.0.2
 Commit SHA-1 hash:  54743c8b7b

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.14393
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\1.0.2

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
livarcocccommented, Apr 18, 2017

@eerhardt @dsplaisted do you guys have any idea if this is possible in MSBuild.

I am not aware of any way to do that in MSBuild. And like I said above, this is something that we explicitly do not support in MSBuild world. I will close the issue to indicate that. But maybe the people above know of a way to achieve something like this in the new project system.

3reactions
livarcocccommented, Apr 12, 2017

If I understand your ask correct, you wanted your reference to be resolved automatically as a project reference or as a package reference.

If that’s correct, this is something that we do not support in csproj. In csproj, you have to be explicit about whether your reference is a Project or a Package by using either ProjectReference or PackageReference.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Automatic project/NuGet reference resolution with new proj ...
I used to be able to reference a package and, depending on build environment (global.json with all of the project's references present and ......
Read more >
PackageReference in project files - NuGet
Package references, using <PackageReference> MSBuild items, specify NuGet package dependencies directly within project files, as opposed to ...
Read more >
NuGet Package Dependency Resolution
When installing packages into projects using the PackageReference format, NuGet adds references to a flat package graph in the appropriate file ...
Read more >
.net - Changing a project reference to a NuGet package ...
My memory of nuget pack on old style csproj files is that nuget will automatically make a project reference a nuget dependency as...
Read more >
Build NuGet Package automatically including referenced ...
How do you create a nuget package ( .nupkg ) from a project, automatically including all dll dependencies and not just those grabbed...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found