-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
P2P references should be transitive #200
Comments
The project system and sdk are in an indeterminate state making it hard for me to repro this consistently. But when I have been able to repro this, I see a project.assets.json that has target libraries like: "ProjectB/1.0.0": {
"type": "project",
"framework": ".NETStandard,Version=v1.4",
"dependencies": {
"ProjectC": "1.0.0",
"Microsoft.NETCore.Sdk": "1.0.0-alpha-20160928-1",
"NETStandard.Library": "1.6.0",
"c:\\Projects\\TransitiveRepro\\ProjectC\\ProjectC.csproj": "1.0.0"
}
},
"ProjectC/1.0.0": {
"type": "project",
"framework": ".NETStandard,Version=v1.4",
"dependencies": {
"Microsoft.NETCore.Sdk": "1.0.0-alpha-20160928-1",
"NETStandard.Library": "1.6.0"
}
} There is an entry for But sometimes I don't get any entry in either library section for the project dependencies. I'm also seeing a possibly related error:
@emgarten @joelverhagen what is the expected output of project.assets.json for Project Dependencies, especially in this transitive case? |
Having ProjectC and the path to ProjectC looks incorrect for the ProjectB entry. I'll take a look at how restore is handling these. |
This change adds a frameworks section under restore metadata, project references are now placed there instead of in both the restore section and the dependencies section. This allows projects to be referenced with a unique name or path, and later resolved to the correct PackageId or project name. The project name can only be known after reading all projects. An additional benefit of splitting up the references between what was provided by msbuild and what is in the spec is that UWP can continue to work exactly as it has in the past, while .NET Core projects can take advantage of the restore metadata. Handling for missing projects is also improved with this change. Resolving a project path to the actual project is now handled in the resolver which allows it to fail in the same way as a missing package. Fixes NuGet/Home#3611 Related to dotnet/sdk#200
This change adds a frameworks section under restore metadata, project references are now placed there instead of in both the restore section and the dependencies section. This allows projects to be referenced with a unique name or path, and later resolved to the correct PackageId or project name. The project name can only be known after reading all projects. An additional benefit of splitting up the references between what was provided by msbuild and what is in the spec is that UWP can continue to work exactly as it has in the past, while .NET Core projects can take advantage of the restore metadata. Handling for missing projects is also improved with this change. Resolving a project path to the actual project is now handled in the resolver which allows it to fail in the same way as a missing package. Fixes NuGet/Home#3611 Related to dotnet/sdk#200
This error no longer occurs, presumably resolved by NuGet/NuGet.Client#924 |
I just ran into this with VS2017 RC:
Here's the solution https://github.com/davidfowl/VS2017TransitiveBug. |
@davidfowl The error you are seeing is Bug #355 |
#355 tracks the bad failure mode seen above, but transitive P2P ref support is not supported yet. dotnet/project-system#199 tracks the project-system side. I am reopening this to track any SDK work. |
Note that migration from project.json will lift the transitive closure for you with metadata on extra P2P refs so they can be removed once the feature work is done. For now, with the preview project system/CLI/SDK bits in VS 2017 RC, you must add explicit project references as needed (ProjectA -> ProjectC in the example). |
See dotnet/project-system#199 (comment). We need to raise the project reference information in lock file to ProjectReference items in ResolveProjectReferences. |
严重性 代码 说明 项目 文件 行 Suppression State |
Handling relative path for MsDeploy PackageLocation
@davidfowl I know this is a very old issue now, but I've been considering this recently and I'd like to ask: was any consideration given to how this "feature" affects separation of concerns? Transitive references allow a presentation layer, by default, to directly access classes in a DAL if you have n-tier architecture Whilst it's possible to edit the Am I missing something here? Is it somehow not a problem that transitive references expose a bunch of stuff to layers that shouldn't have access to that stuff? |
The thing we were trying to solve with flowing transitive deps by default was forcing consumers to reference the transitive closure manually. That is A -> B -> C and now A has to add a reference to C because it used something from B that exposed C. This is a bad default that makes things unusable. This became apparent in early .NET Core because we had something on the order of ~100 packages that needed to be manually referenced transitively. The perfect implementation of this would use the compiler to figure out what references are exposed but not declared as transitive force you to mark those. |
@davidfowl So what is the recommendation for people who want the old behaviour, when A shouldn't be able to reference C? Is it just always to manually edit the .csproj file? Given that this is a somewhat common requirement, should something be added to the VS GUI to do it for you? |
Yes manually edit the csproj. I don't think something should be added to the VS UI no. I'd much rather prefer a build step that told you what you needed to expose based on "public API" or something to that effect. |
Manually editing the csproj file doesn't work that well.. you'd need to remove the reference from the compiler right before csc is called, most other workarounds that were tried in the past also lead to the dll file missing in the output. |
@dasMulli why doesn't manually editing the csproj work? |
Ah looks doable now by removing the correspending |
So, to design a solution with proper separation of concerns, manually edit a file you don't normally have to touch in a way that none of our tutorials will tell you to do. Just doesn't sit right with me. It should be more default, more obvious, more clearly recommended. |
Tbh the concept is not unreasonable to ask for but it boils down to basing enforcing of architectural decisions on side effects of the build system.. (-> new issue for an opt out feature? Maybe loop in msbuild people since i don't know what the side effects of assembly / conflict resolution of various possible solutions could be) |
@dasMulli Still, using something like that at unit test time doesn't stop undesirable interfaces from showing up in IntelliSense at design time. I know I might seem a bit fussy, but if I'm working in my presentation layer, VS shouldn't be offering me an autocomplete of |
* since outputregistry null is used to signal docker, it cannot be required * add explicit documentation
Example: Consider the below dependency chain
ProjectA-> ProjectB->ProjectC
Here ProjectA depends on ProjectC but build fails with error
C:\Users\sridhper\.nuget\packages\microsoft.netcore.sdk\1.0.0-alpha-20160923-4\build\netstandard1.0\Microsoft.PackageDependencyResolution.targets(142,5): error : Unexpected Dependency D:\github\tryout\TestAppDependencyGraph \ProjectC\ProjectC.csproj with no version number [D:\github\tryout\TestAppDependencyGraph\ProjectA\ProjectA.csproj]
Point of failure is here
cc @eerhardt
The text was updated successfully, but these errors were encountered: