Compiling Visual Studio extension - problem with Microsoft.VisualStudio namespace

Tomasz Filipek 11 Reputation points
2022-09-20T13:47:38.743+00:00

Hello

I'm learnig how create add-ons for VisualStudio.

First I downloaded this extension: Microsoft Dynamics AX 2012 X++ Editor Extensions (finally I needs a extension to the X ++ editor, hence the choice)

The extension works fine - I'm trying to edit it.

The project loads fine (I'm using Visual 2022), but when I try to compile it crashes into the Microsoft namespace. For example:

  • The type or namespace name 'VisualStudio' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
  • The type or namespace name 'IAdornmentLayer' could not be found (are you missing a using directive or an assembly reference?)
  • The type or namespace name 'IWpfTextView' could not be found (are you missing a using directive or an assembly reference?)

I tried to solve the problem by adding the library Microsoft.VisualStudio.QualityTools.UnitTestFramework to the project, but then I got next errors. For example - I have in project:

using Microsoft.VisualStudio.Text.Classification;
using Microsoft.VisualStudio.Text.Editor;

This generate errors:

The type or namespace name 'Text' does not exist in the namespace 'Microsoft.VisualStudio' (are you missing an assembly reference?)

For test I change target framework from .NET framework 4 to .NET framework 4.5 (and change node SupportedFrameworkRuntimeEdition in \obj\Debug\extension.vsixmanifest file) - in this configuration compiling is done correctly (but extension not works in X++ editor - so this not resolve my problem).

I'm using:

  • Microsoft Visual Studio Community 2022 (64-bit) - Version 17.3.4
  • Windows Server 2012 R2

How can I solve this problem?

Regards, Tomasz

Community Center Not monitored
0 comments No comments
{count} vote

3 answers

Sort by: Most helpful
  1. Tianyu Sun-MSFT 34,436 Reputation points Microsoft External Staff
    2022-09-21T09:12:26.007+00:00

    Hello @Tomasz Filipek ,

    Welcome to Microsoft Q&A forum.

    Looks like the initial version of this extension is designed for VS 2010. I see that the last update was Apr 20, 2017. So I’m not very sure whether it still compatible with VS 2022. But for the errors that you got, I guess it’s caused by VS didn’t load the dll files well. If you try to double-click the errors which are listed in the Error List and do nothing(I mean stop there, and wait for VS finishes loading and detecting the dll files), will the errors disappear?

    Best Regards,
    Tianyu

    • If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
      Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
    1 person found this answer helpful.
    0 comments No comments

  2. Tomasz Filipek 11 Reputation points
    2022-09-21T10:27:56.637+00:00

    I created Virtual Machine with Windows 7, installed Visual Studio Professional 2010 SP1 + SDK - on this setup everything works fine :).

    1 person found this answer helpful.

  3. Patrick Q 0 Reputation points
    2024-06-18T14:17:46.45+00:00

    I use the same extension with our old AX2012 system, and I am able to build it on VS2022. The problem is with missing references for a bunch of Microsoft.VisualStudio.xxx.dll libraries. There are new versions for this on nuget, but since we're talking about legacy stuff here, that won't work.

    I ended up looking in the AX installation directory for the client, specifically in the EditorComponents folder, and there were the library files that were missing. Simply add a reference in your project to them, and build the solution.

    You might need to fix an error in the source.extension.vsixmanifest file in the JAEECurrentLineHighlight project as well. The <Author> tag doesn't contain a value... Simply add a text value here (i would recommend to use the original value José Antonio Estevan, as a credit to the original author), and your build should be successful.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.