Open
Description
Problem
After building the runtime repo project with:
build.cmd clr+libs -rc release
I was unable to port docs from Microsoft.Extensions.Hosting.WindowsServices due to an exception when opening the project: Unresolved metadata reference removed from project
.
Output
$ PortToTripleSlash.exe \
-Docs $ENV:SOURCEREPOS\dotnet-api-docs\xml
-CsProj $ENV:SOURCEREPOS\runtime\src\libraries\Microsoft.Extensions.Hosting.WindowsServices\src\Microsoft.Extensions.Hosting.WindowsServices.csproj
-IncludedAssemblies Microsoft.Extensions.Hosting.WindowsServices
-IncludedNamespaces Microsoft.Extensions.Hosting.WindowsServices
Verifying CLI arguments...
Specified Docs xml locations:
- C:\Users\calope\source\repos\dotnet-api-docs\xml
Included assemblies:
- Microsoft.Extensions.Hosting.WindowsServices
Included namespaces:
- Microsoft.Extensions.Hosting.WindowsServices
Querying for all Visual Studio instances...
Looking for the latest stable instance of Visual Studio, if there is one...
Selected instance:
- MSBuildPath: C:\Program Files\dotnet\sdk\7.0.200
- Version: 7.0.200
Attempting to register assembly loader...
Attempting to register Visual Studio instance
Successful Visual Studio load!
Looking for a resolved workspace that contains the project 'C:\Users\calope\source\repos\runtime\src\libraries\Microsoft.Extensions.Hosting.WindowsServices\src\Microsoft.Extensions.Hosting.WindowsServices.csproj'...
Did not find an existing resolved project for path C:\Users\calope\source\repos\runtime\src\libraries\Microsoft.Extensions.Hosting.WindowsServices\src\Microsoft.Extensions.Hosting.WindowsServices.csproj. Creating a workspace for it...
Looking for a resolved project that contains the project 'C:\Users\calope\source\repos\runtime\src\libraries\Microsoft.Extensions.Hosting.WindowsServices\src\Microsoft.Extensions.Hosting.WindowsServices.csproj'...
Did not find an existing resolved project for path 'C:\Users\calope\source\repos\runtime\src\libraries\Microsoft.Extensions.Hosting.WindowsServices\src\Microsoft.Extensions.Hosting.WindowsServices.csproj'. Attempting to find the project in this workspace...
Found the project in this workspace. Attempting to get compilation...
Found the compilation for this project. Creating the resolved project...
Unhandled exception. System.Exception:
Project.OpenProjectAsync - C:\Users\calope\source\repos\runtime\src\libraries\Microsoft.Extensions.Hosting.WindowsServices\src\Microsoft.Extensions.Hosting.WindowsServices.csproj
Warning - Unresolved metadata reference removed from project: C:\Users\calope\source\repos\runtime\artifacts\bin\System.Diagnostics.DiagnosticSource\Debug\netstandard2.0\System.Diagnostics.DiagnosticSource.dll
at ApiDocsSync.PortToTripleSlash.MSBuildLoader.ThrowIfDiagnosticsFound(ResolvedWorkspace resolvedWorkspace, String origin, Boolean isMono) in C:\Users\calope\source\repos\api-docs-sync\src\PortToTripleSlash\src\libraries\MSBuildLoader.cs:line 175
at ApiDocsSync.PortToTripleSlash.MSBuildLoader.LoadProjectAsync(String projectPath, Boolean isMono, CancellationToken cancellationToken) in C:\Users\calope\source\repos\api-docs-sync\src\PortToTripleSlash\src\libraries\MSBuildLoader.cs:line 80
at ApiDocsSync.PortToTripleSlash.MSBuildLoader.LoadMainProjectAsync(String projectPath, Boolean isMono, CancellationToken cancellationToken) in C:\Users\calope\source\repos\api-docs-sync\src\PortToTripleSlash\src\libraries\MSBuildLoader.cs:line 63
at ApiDocsSync.PortToTripleSlash.PortToTripleSlash.Main(String[] args) in C:\Users\calope\source\repos\api-docs-sync\src\PortToTripleSlash\src\app\PortToTripleSlash.cs:line 19
at ApiDocsSync.PortToTripleSlash.PortToTripleSlash.<Main>(String[] args)
Workaround
Go to the folder of that assembly and build it before porting:
$ cd .\src\libraries\Microsoft.Extensions.Hosting.WindowsServices
$ dotnet build
MSBuild version 17.6.0-preview-23174-01+e7de13307 for .NET
Determining projects to restore...
Restored C:\Users\calope\source\repos\runtime\src\libraries\Common\tests\TestUtilities\TestUtilities.csproj (in 1.11 sec).
Restored C:\Users\calope\source\repos\runtime\src\libraries\Microsoft.Extensions.Hosting.WindowsServices\tests\Microsoft.Extensions.Hosting.Windo
wsServices.Tests.csproj (in 1.09 sec).
78 of 80 projects are up-to-date for restore.
Microsoft.Interop.SourceGeneration -> C:\Users\calope\source\repos\runtime\artifacts\bin\Microsoft.Interop.SourceGeneration\Debug\netstandard2.0\
Microsoft.Interop.SourceGeneration.dll
Microsoft.Extensions.Primitives -> C:\Users\calope\source\repos\runtime\artifacts\bin\Microsoft.Extensions.Primitives\ref\Debug\net8.0\Microsoft.
Extensions.Primitives.dll
...
...
Build succeeded.
0 Warning(s)
0 Error(s)
Porting again succeeds:
Output
$ PortToTripleSlash.exe -Docs C:\Users\calope\source\repos\dotnet-api-docs\xml -CsProj C:\Users\calope\source\repos\runtime\src\libraries\Microsoft.Extensions.Hosting.WindowsServices\src\Microsoft.Extensions.Hosting.WindowsServices.csproj -IncludedAssemblies Microsoft.Extensions.Hosting.WindowsServices -IncludedNamespaces Microsoft.Extensions.Hosting.WindowsServices
Verifying CLI arguments...
Specified Docs xml locations:
- C:\Users\calope\source\repos\dotnet-api-docs\xml
Included assemblies:
- Microsoft.Extensions.Hosting.WindowsServices
Included namespaces:
- Microsoft.Extensions.Hosting.WindowsServices
Querying for all Visual Studio instances...
Looking for the latest stable instance of Visual Studio, if there is one...
Selected instance:
- MSBuildPath: C:\Program Files\dotnet\sdk\7.0.200
- Version: 7.0.200
Attempting to register assembly loader...
Attempting to register Visual Studio instance
Successful Visual Studio load!
Looking for a resolved workspace that contains the project 'C:\Users\calope\source\repos\runtime\src\libraries\Microsoft.Extensions.Hosting.WindowsServices\src\Microsoft.Extensions.Hosting.WindowsServices.csproj'...
Did not find an existing resolved project for path C:\Users\calope\source\repos\runtime\src\libraries\Microsoft.Extensions.Hosting.WindowsServices\src\Microsoft.Extensions.Hosting.WindowsServices.csproj. Creating a workspace for it...
Looking for a resolved project that contains the project 'C:\Users\calope\source\repos\runtime\src\libraries\Microsoft.Extensions.Hosting.WindowsServices\src\Microsoft.Extensions.Hosting.WindowsServices.csproj'...
Did not find an existing resolved project for path 'C:\Users\calope\source\repos\runtime\src\libraries\Microsoft.Extensions.Hosting.WindowsServices\src\Microsoft.Extensions.Hosting.WindowsServices.csproj'. Attempting to find the project in this workspace...
Found the project in this workspace. Attempting to get compilation...
Found the compilation for this project. Creating the resolved project...
Looking for Docs xml files...
Type 'T:Microsoft.Extensions.Hosting.WindowsServices.WindowsServiceHelpers' added with 1 member(s) included: C:\Users\calope\source\repos\dotnet-api-docs\xml\Microsoft.Extensions.Hosting.WindowsServices\WindowsServiceHelpers.xml
Type 'T:Microsoft.Extensions.Hosting.WindowsServices.WindowsServiceLifetime' added with 6 member(s) included: C:\Users\calope\source\repos\dotnet-api-docs\xml\Microsoft.Extensions.Hosting.WindowsServices\WindowsServiceLifetime.xml
Finished looking for Docs xml files.
Looking for symbol locations for all Docs types...
Symbol 'T:Microsoft.Extensions.Hosting.WindowsServices.WindowsServiceHelpers' located in 'C:\Users\calope\source\repos\runtime\src\libraries\Microsoft.Extensions.Hosting.WindowsServices\src\WindowsServiceHelpers.cs'.
Adding tree 'C:\Users\calope\source\repos\runtime\src\libraries\Microsoft.Extensions.Hosting.WindowsServices\src\WindowsServiceHelpers.cs' for 'T:Microsoft.Extensions.Hosting.WindowsServices.WindowsServiceHelpers'...
Looking for a resolved workspace that contains the project 'C:\Users\calope\source\repos\runtime\src\libraries\Microsoft.Extensions.Hosting\src\Microsoft.Extensions.Hosting.csproj'...
...
...
Now attempting to port all found symbols...
Porting comments for 'Microsoft.Extensions.Hosting.WindowsServices.WindowsServiceHelpers'. Locations: 1...
Porting docs for tree 'C:\Users\calope\source\repos\runtime\src\libraries\Microsoft.Extensions.Hosting.WindowsServices\src\WindowsServiceHelpers.cs'...
Docs ported to 'Microsoft.Extensions.Hosting.WindowsServices.WindowsServiceHelpers'.
Porting comments for 'Microsoft.Extensions.Hosting.WindowsServices.WindowsServiceLifetime'. Locations: 1...
Porting docs for tree 'C:\Users\calope\source\repos\runtime\src\libraries\Microsoft.Extensions.Hosting.WindowsServices\src\WindowsServiceLifetime.cs'...
Docs ported to 'Microsoft.Extensions.Hosting.WindowsServices.WindowsServiceLifetime'.