Automatic project/NuGet reference resolution with new proj files?
See original GitHub issueTL;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
- Have a
project.json
referencing a package by name - 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 - Demonstrate that if the project is built in isolation, the reference will be resolved via NuGet
dotnet migrate
- 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
ORPackageReference
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:
- Created 6 years ago
- Reactions:1
- Comments:8 (5 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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.
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.