microsoft / ConcordExtensibilitySamples

Visual Studio Debug Engine Extensibility Samples
Other
121 stars 50 forks source link

Wiki missing info - Obtaining the Concord API headers #72

Closed akbyrd closed 2 years ago

akbyrd commented 2 years ago

This page mentions 2 ways to get the headers and libs: the Visual Studio Extensibility workload and nuget. https://github.com/Microsoft/ConcordExtensibilitySamples/wiki/Obtaining-the-Concord-API-headers,-libraries,-etc

I'm using the first method and that page doesn't describe how to actually reference the headers and libs from a C++ project. I can find the files in paths below, but they are not part of the set of resolved paths in a default C++ project.

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VSSDK\VisualStudioIntegration\Common\Inc C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VSSDK\VisualStudioIntegration\Common\Lib\x64 etc

Nor do I see any new macros that include VSSDK or VisualStudioIntegration paths. It's not clear to me what the intended way to get at those files is. I can use $(VsInstallDir) and manually add the header and lib dirs I need. Is that the intended way?

Additional Include Directories: $(VSInstallDir)VSSDK\VisualStudioIntegration\Common\Inc Additional Library Directories: $(VSInstallDir)VSSDK\VisualStudioIntegration\Common\Lib\$(PlatformTarget)

akbyrd commented 2 years ago

I'm working through how to get set up for Concord extensibility from scratch. Here's my experience so far. Apologies for any silly mistakes - I'm kinda just stumbling my way through. Once I'm done my hope is that some of this process can make it into the wiki. I can create a pull request if desired.

Workflow 1 - Visual Studio Extensibility workload

Workflow 2 - Nuget

To be continued

I'll add another post when I get further.

akbyrd commented 2 years ago

Actually, I think that's it for getting the headers and libs. Lots more to the process, but not particularly relevant here.

gregg-miskelly commented 2 years ago

Hi @akbyrd, I am just getting back from vacation.

The documentation that you linked to is incorrect for VS 2022 -- Concord headers and libs are now only available via nuget.

For your 'Workflow 2' questions:

VSDConfigTool adds vsdconfig.xsd to the solution automatically. This file causes an error.

I don't know why you would be seeing an error about vsdconfig.xsd or what would be adding it. This is an XML schema there to make it easier to edit your .vsdconfigxml files. It is useful, but optional.

akbyrd commented 2 years ago

Installing the Microsoft.VSSDK.Debugger.VSDConfigTool adds the vsd to the project. It has its content type set to XML Data Generator Tool. This causes it to be run through xsd.exe which relies on CppCodeProvider.dll to be in the GAC. If you've never installed an older version of VS or manually added that dll to the GAC then it won't be there and it causes a build error.

gregg-miskelly commented 2 years ago

Are you seeing this in the samples? Or just your own project? What version of VS are you using? If you are using the samples, are you using master or the VS17 branch?

Are you sure that it the package reference to VSDConfigTool that adds it to the project and not the project file itself? I don't see anything in the package that would add that. The sample projects do include that file as a None item (see here), though I don't have any idea why that would somehow kick in the XSD tool.

akbyrd commented 2 years ago

My own project. VS 2019 16.11.8. I can repro it by making a new solution, grabbing the nuget package, and compiling. But it'll only happen if you've never installed VS 2017 or earlier, so probably easier to repro in a VM.

It's an issue with the nuget package I assume. Not this repo.

I've attached a project following those steps. Here's the package manager output.

Attempting to gather dependency information for package 'Microsoft.VSSDK.Debugger.VSDConfigTool.17.0.1110801' with respect to project 'VSDCT Package Issue', targeting 'native,Version=v0.0'
  GET https://api.nuget.org/v3/registration5-gz-semver2/microsoft.vssdk.debugger.vsdconfigtool/index.json
  OK https://api.nuget.org/v3/registration5-gz-semver2/microsoft.vssdk.debugger.vsdconfigtool/index.json 228ms
Total number of results gathered : 1
Gathering dependency information took 270 ms
Summary of time taken to gather dependencies per source :
https://api.nuget.org/v3/index.json -   248 ms
Attempting to resolve dependencies for package 'Microsoft.VSSDK.Debugger.VSDConfigTool.17.0.1110801' with DependencyBehavior 'Lowest'
Resolving dependency information took 0 ms
Resolving actions to install package 'Microsoft.VSSDK.Debugger.VSDConfigTool.17.0.1110801'
Resolved actions to install package 'Microsoft.VSSDK.Debugger.VSDConfigTool.17.0.1110801'
Retrieving package 'Microsoft.VSSDK.Debugger.VSDConfigTool 17.0.1110801' from 'nuget.org'.
For adding package 'Microsoft.VSSDK.Debugger.VSDConfigTool.17.0.1110801' to project 'VSDCT Package Issue' that targets 'native'.
For adding package 'Microsoft.VSSDK.Debugger.VSDConfigTool.17.0.1110801' to project 'VSDCT Package Issue' that targets 'native'.
Adding package 'Microsoft.VSSDK.Debugger.VSDConfigTool.17.0.1110801' to folder 'C:\Users\akbyrd\Desktop\VSDCT Package Issue\packages'
Added package 'Microsoft.VSSDK.Debugger.VSDConfigTool.17.0.1110801' to folder 'C:\Users\akbyrd\Desktop\VSDCT Package Issue\packages'
Added package 'Microsoft.VSSDK.Debugger.VSDConfigTool.17.0.1110801' to folder 'C:\Users\akbyrd\Desktop\VSDCT Package Issue\packages' from source 'https://api.nuget.org/v3/index.json'
Added file 'vsdconfig.xsd'.
Added file 'vsdconfig.xsd' to project 'VSDCT Package Issue'.
Added package 'Microsoft.VSSDK.Debugger.VSDConfigTool.17.0.1110801' to 'packages.config'
Added file 'packages.config' to project 'VSDCT Package Issue'.
Successfully installed 'Microsoft.VSSDK.Debugger.VSDConfigTool 17.0.1110801' to VSDCT Package Issue
Executing nuget actions took 3.14 sec
Time Elapsed: 00:00:04.1888893
========== Finished ==========

VSDCT Package Issue.zip

gregg-miskelly commented 2 years ago

Got it. The nuget package manager apparently has a behavior that I wasn't aware of where it will copy and add an Xsd item when adding a reference. Fortunately, this is trivial to work around: undo the damage that the nuget package manager did by deleting the copied vsdconfig.xsd.

Since there is a lot of discussion in this issue about various things I am breaking out this bug into a new issue: https://github.com/microsoft/ConcordExtensibilitySamples/issues/74

akbyrd commented 2 years ago

The documentation that you linked to is incorrect for VS 2022 -- Concord headers and libs are now only available via nuget.

I grabbed 2022 to start testing my extension against it. I noticed the headers, lib, and one of the targets files are still included with the VSSDK. Are you saying that shouldn't be there anymore or that it will go away in the future?

gregg-miskelly commented 2 years ago

Well, there was a plan to remove it that I thought happened, but apparently only the work to remove the .NET reference assemblies actually happened. I am not sure what the future is for it. I will update the docs accordingly, but I would recommend sticking with nuget packages unless you have an existing project that you don't want to touch.

akbyrd commented 2 years ago

Sounds good. Thank you.