Closed natidea closed 7 years ago
It appears unresolved packages are not in the project.assets.json (project.lock.json) and will need to be added in order to create a diagnostic
The cli ProjectModel would determine this by comparing the projectFileDependencyGroups
in the lock file section with the actual resolved dependencies.
https://github.com/dotnet/cli/blob/rel/1.0.0/src/Microsoft.DotNet.ProjectModel/Graph/LockFile.cs#L35
Won't the "restore" fail when a package is unresolved?
restore would fail , but lock file should still be generated. Yes, we could do same thing what ProjectMOdel did.
Here are the list of diagnostics:
Here's where we created them (if that's relevant)
Build without restore - https://github.com/dotnet/cli/blob/d7b0190bd4ce49121a7cd5bdc0423ab85229a085/src/Microsoft.DotNet.ProjectModel/ProjectContextBuilder.cs#L310
Asset file/lock file invalid (dependencies updated without running restore) - https://github.com/dotnet/cli/blob/d7b0190bd4ce49121a7cd5bdc0423ab85229a085/src/Microsoft.DotNet.ProjectModel/ProjectContextBuilder.cs#L319
Reference assemblies not found (common when building on mono) - https://github.com/dotnet/cli/blob/d7b0190bd4ce49121a7cd5bdc0423ab85229a085/src/Microsoft.DotNet.ProjectModel/ProjectContextBuilder.cs#L334
Framework not installed (.NET Framework Reference assemblies) - https://github.com/dotnet/cli/blob/d7b0190bd4ce49121a7cd5bdc0423ab85229a085/src/Microsoft.DotNet.ProjectModel/ProjectContextBuilder.cs#L349 PS: We need to do this same thing for shared runtimes on .NET Core
Dependency diagnostics:
Unresolved dependency - https://github.com/dotnet/cli/blob/d7b0190bd4ce49121a7cd5bdc0423ab85229a085/src/Microsoft.DotNet.ProjectModel/Resolution/LibraryManager.cs#L58
Incompatible dependency - https://github.com/dotnet/cli/blob/d7b0190bd4ce49121a7cd5bdc0423ab85229a085/src/Microsoft.DotNet.ProjectModel/Resolution/LibraryManager.cs#L64
Dependency mismatch - https://github.com/dotnet/cli/blob/d7b0190bd4ce49121a7cd5bdc0423ab85229a085/src/Microsoft.DotNet.ProjectModel/Resolution/LibraryManager.cs#L121
**Single "type:platform" dependency*** - https://github.com/dotnet/cli/blob/d7b0190bd4ce49121a7cd5bdc0423ab85229a085/src/Microsoft.DotNet.ProjectModel/Resolution/LibraryManager.cs#L144
Dependency conflicts - https://github.com/dotnet/cli/blob/d7b0190bd4ce49121a7cd5bdc0423ab85229a085/src/Microsoft.DotNet.ProjectModel/Resolution/LibraryManager.cs#L175
dotnet-compile
had logic that printed out these errors on build https://github.com/dotnet/cli/blob/d7b0190bd4ce49121a7cd5bdc0423ab85229a085/src/dotnet/commands/dotnet-compile/Compiler.cs#L135-L182.Once a system like this is in place and going to all the right places and all the right editors and command line experiences, it becomes trivial to add new ones.
/cc @emgarten @rrelyea
@natidea I think some of these diagnostics will be covered by the work you are doing for #1026
I believe these have been addressed. So, I am closing this item. @natidea, if there is anything missing, please, re-activate and let us know what you need from SDK.
Diagnostics. In some cases when your task can detect error or warning for some packages, it should send diagnostics associated with that package. For example:
Here is a full list of diagnostics we had (not all of them are applicable to lock file): https://github.com/dotnet/cli/blob/rel/1.0.0/src/Microsoft.DotNet.ProjectModel/ErrorCodes.NuGet.cs