Skip to content
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

"ResolveComReference" task error when using a new-style csproj #3777

Closed
willson556 opened this issue Dec 17, 2018 · 4 comments
Closed

"ResolveComReference" task error when using a new-style csproj #3777

willson556 opened this issue Dec 17, 2018 · 4 comments
Assignees
Labels
bug A bug to fix dotnet: msbuild msbuild integration for .NET API reference docs dotnet Generate .NET API reference docs

Comments

@willson556
Copy link

DocFX Version Used: docfx.console 2.40.4 with VS Pro 15.9.4

Template used: default

Steps to Reproduce:

  1. Close all instances of MSBuild.exe.
  2. Run build.bat in https://github.com/willson556/DocFXCOMReferenceBug repo.
  3. Observe the following warning in the console output:
Warning:[MetadataCommand.ExtractMetadata](C:/Users/willsont/projects/DocFXCOMReferenceBug/ReferencedApp/ReferencedApp.csproj)Workspace failed with: [Failure] Msbuild failed when processing the file 'C:\Users\willsont\projects\DocFXCOMReferenceBug\ReferencedApp\ReferencedApp.csproj' with message: C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets: (2729, 5): Could not run the "ResolveComReference" task because MSBuild could not create or connect to a task host with runtime "CLR4" and architecture "x86".  Please ensure that (1) the requested runtime and/or architecture are available on the machine, and (2) that the required executable "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe" exists and can be run.
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets: (2749, 7): The "ResolveComReference" task's outputs could not be retrieved from the "ResolvedFiles" parameter. Object does not match target type.

  1. Open procexp.exe and see several open MSBuild.exe processes with Handle to DocFXComReferenceBug/ReferencedApp.

Expected Behavior:

  • DocFX extracts metadata successfully from new-style .csproj with a COM Reference.
  • Files are not locked at conclusion of CI-build allowing cleanup of CI workspace.

Actual Behavior:

  • Warning is logged.
  • Files are left locked.

Additional Notes:

This issue does not occur when using a old-style .csproj (without Sdk attribute).
I'm not sure how much of this issue falls on MSBuild vs MSBuild.Sdk.Extras vs. DocFX's invocation of MSBuild. I filed the issue here because I figured the DocFX team was better placed than me to answer any follow-up questions the MSBuild team might have.

One other thing I did notice is that DocFX doesn't pass the /nr:false flag along to the MSBuild processes it creates -- we have to set the MSBUILDDISABLENODEREUSE=1 environment variable.

Possibly Related Issues in other Microsoft Repos:

Thanks!

@willson556
Copy link
Author

Has anyone had a chance to look into this?

@herohua herohua self-assigned this Jan 22, 2019
@stale
Copy link

stale bot commented Apr 22, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in a week if no further activity occurs.

@stale stale bot added the stale label Apr 22, 2019
@superyyrrzz superyyrrzz added dotnet Generate .NET API reference docs bug A bug to fix labels Apr 24, 2019
@stale stale bot removed the stale label Apr 24, 2019
@rapmue
Copy link

rapmue commented Aug 12, 2019

I got something similar, also happening with new SDK style projects and regarding ResolveComReference.

But I think it startet with docfx version 2.44.

The error I got is the following:

[19-08-12 09:14:17.192]Warning:[MetadataCommand.ExtractMetadata](XXX.sln)Workspace failed with: [Failure] Msbuild failed when processing the file 'XY.csproj' with message: C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets: (2729, 5): Die ResolveComReference-Aufgabe konnte nicht aus "Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" instanziiert werden. Die Datei oder Assembly "Microsoft.Build, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" oder eine Abhängigkeit davon wurde nicht gefunden. Das System kann die angegebene Datei nicht finden.
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets: (2729, 5): Die "ResolveComReference"-Aufgabe wurde falsch deklariert, falsch verwendet oder konnte bei der Erstellung nicht ausgeführt werden. Überprüfen Sie die Schreibweise des Aufgaben- und des Assemblynamens.

I have no idea why the error message is partly german. It states something like:

The ResolveComReference-task could not be instantiated. The file or assembly "Microsoft.Build" or a dependency could not be found.

and the second part something like:

The ResolveComReference-task is declared wrong, applied wron or could not be executed upon creation. Check the spelling of the task and the assembly name.

The error occurs, when a SDK-style project with COM references is added to the solution.

@yufeih yufeih added the dotnet: msbuild msbuild integration for .NET API reference docs label Dec 15, 2022
@yufeih
Copy link
Contributor

yufeih commented Feb 5, 2023

It appears the issue was resolved in the latest version:

image

@yufeih yufeih closed this as completed Feb 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug to fix dotnet: msbuild msbuild integration for .NET API reference docs dotnet Generate .NET API reference docs
Projects
None yet
Development

No branches or pull requests

5 participants