-
Notifications
You must be signed in to change notification settings - Fork 392
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
Transitive references #199
Comments
We think the cost here is going to be in two places:
We think that the language service will basically get this for free if MSBuild raises them as normal |
Any way we could schedule this for RC? We're running into issues migrating projects with nested project dependencies, including cli repo itself. |
Unlikely. This is a fairly large work item that has compat implications. Can the migration tool flatten the hierarchy? |
Lacking transitivity for projects is a problem for For example, in NuGet, one of our "entry point" packages is After migrating this project to .csproj and using
|
I don't think that's related - this seems like a pack issue. Whether a project reference is transitive or not shouldn't affect when it ends up in a dependency in the nupkg. |
Actually, I think it's a conversion work item we should mark the references so that they don't turn up as refs during the conversion. |
@brthor ^ |
So is migration supposed to promote the refs or not promote them for pack? We have this issue open for the migration work to promote refs and project refs, https://github.com/dotnet/cli/issues/4414 Should the promoted refs just be marked PrivateAssets All? will that fix the pack scenario? @joelverhagen |
Still promote the refs - should mark them with the metadata to opt them out of refs for pack. Work with NuGet. |
Talked with @joelverhagen offline, PrivateAssets should do the trick |
This is the current proposal for how we could implement this:
Tagging @kieranmo @davidfowl @davkean @yigalataz @rrelyea. Let me know if I missed anything from yesterday's discussion. |
Distilling the workitems from the above proposal:
|
If i'm understanding this fix correctly we'll also need to stop migrating transitive framework assemblies in the CLI. |
@davidfowl You could also use a target to replace a |
@dsplaisted no, the point is I don't want to replace anything in the project at all. So explain to me how I would do the exact same thing? Where the presence of a property in an import automagically changes all of my references from package to project in a way the IDE is ok with? |
Ok, that's a good scenario. I like packagereference with project metadata for that. It is different from Sri's proposal, though. I'm pushing back against a package reference that has only a project path. |
We discussed both those syntaxes and the concern with the Referencing something by name or path is also the existing pattern for |
I'm missing how that addresses @davidfowl's scenario. If the projects are spread across repos and I want to be able to build from packages sometimes and projects other times, the projects might not even be on my machine. So the ID is not redundant when I don't have the project in hand. Or would he instead be expected to do |
You don't modify the project file itself, the import has a target that modifies the set of <Target Name="ReplacePackageReferences" BeforeTargets="_LoadRestoreGraphEntryPoints;PrepareProjectReferences">
<PackageReference Remove="Microsoft.AspNetCore.Mvc" />
<ProjectReference Include="$(Microsoft.AspNetCore.Mvc)" />
</Target> This removes any |
@nguerrera we can do what @dsplaisted suggests for PackageReference as well to switch. As for PackageReference vs ProjectReference the argument that was made in favour of PackageReference was that ProjectReferences are references to projects producing assemblies and that's an existing concept and those are not transitive. Referencing a package is a new concept and packages are transitive regardless of whether they are referenced by name\version or a path to a project that produces one |
I don't think everyone who wants transitive P2P refs would think of their projects as "producing nuget packages". I can imagine lots of customers with big solutions that never package their stuff, but still want the convenience of transitive P2P. |
…et so that it can write them (and their closures) to the assets file. This is to partly address transitive project references dotnet#199
@davidfowl when swapping a package with a project should the project be open in the solution or do you work in another visualstudio instance? And will the UI take care not removing the Project="$(Microsoft.AspNetCore.Mvc)" part when updating a project? |
This is now done. |
…115.1 (dotnet#199) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19565.1
Turns out that the .NET SDK lifts transitive project references as direct references (without any additional metadata), and this causes the second-level dependency from being built unexpectedly (see dotnet/sdk#478 and dotnet/project-system#199). Since we don't want to disrupt the IDE (BuildingInsideVisualStudio) and we only want to fix this for the very specific case of running from the CLI `dotnet pack --no-build`, we make the fix very constrained for that scenario. We check for `NoBuild` but ALSO for `_IsPacking`, which is passed by the `dotnet pack` command. This ensures minimal impact in all other scenarios, since we're essentially turning off a built-in behavior in the SDK that has explicit side-effects (by design and desirable) and we should preserve. #Fixes 501
Turns out that the .NET SDK lifts transitive project references as direct references (without any additional metadata), and this causes the second-level dependency from being built unexpectedly (see dotnet/sdk#478 and dotnet/project-system#199). Since we don't want to disrupt the IDE (BuildingInsideVisualStudio) and we only want to fix this for the very specific case of running from the CLI `dotnet pack --no-build`, we make the fix very constrained for that scenario. We check for `NoBuild` but ALSO for `_IsPacking`, which is passed by the `dotnet pack` command. This ensures minimal impact in all other scenarios, since we're essentially turning off a built-in behavior in the SDK that has explicit side-effects (by design and desirable) and we should preserve. #Fixes 501
Turns out that the .NET SDK lifts transitive project references as direct references (without any additional metadata), and this causes the second-level dependency from being built unexpectedly (see dotnet/sdk#478 and dotnet/project-system#199). Since we don't want to disrupt the IDE (BuildingInsideVisualStudio) and we only want to fix this for the very specific case of running from the CLI `dotnet pack --no-build`, we make the fix very constrained for that scenario. We check for `NoBuild` but ALSO for `_IsPacking`, which is passed by the `dotnet pack` command. This ensures minimal impact in all other scenarios, since we're essentially turning off a built-in behavior in the SDK that has explicit side-effects (by design and desirable) and we should preserve. #Fixes 501
◦xproj you only need to declare top level dependencies and others are pulled in automatically
◦This also has an impact on the publish artifacts. csproj only pulls from referenced assemblies and has special logic to exclude assemblies which are not actually used in code.
The text was updated successfully, but these errors were encountered: