Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
mmkuklinski
@mmkuklinski
Ramon Viladomat
@Viladoman
Does anybody know if any of the last updates on VS2022 broke the IViewTaggerProvider. They don't get created and even the example on the documentation does not work anymore: https://docs.microsoft.com/en-us/visualstudio/extensibility/walkthrough-highlighting-text?view=vs-2022 ( it used to work on the first VS 2022 preview and older VS versions ). Of course it might be a bad setup on my end, If someone has a working example on a simple text highlight on latest VS2022 I would really appreciate it.
1 reply
wangrd
@wangrd
How can i extend the Git changes page in vs2022? We can get it from ITeamExplorer- > GitChanges in vs2019-,but it not work in vs2022.
2 replies
Mike Hershberg
@mhershberg
Hello. I'm a bit stumped. In my extension I have an event handler for "OnAfterOpenProject" but when I try to find the project by name using VS.Solutions.FindProjectAsync it returns null. Shouldn't the project be opened when OnAfterOpenProject executes? Here is a code snippet:
public int OnAfterOpenProject(IVsHierarchy pHierarchy, int fAdded)
{
    ThreadHelper.ThrowIfNotOnUIThread();

    if (pHierarchy.GetProperty(VSConstants.VSITEMID_ROOT, (int)__VSHPROPID.VSHPROPID_Name, out object propValue) == VSConstants.S_OK)
    {
        string name = propValue as string;
        if (name != null && string.Equals(name, TARGET_PROJECT_NAME))
        {
            Project project = await VS.Solutions.FindProjectsAsync(name);
            // PROJECT IS NULL!!!!!
        }
    }

    return VSConstants.S_OK;
}
4 replies
Marimuthu
@maroldo26
Hi All,
I'm trying to port a extension built for VS 2010 to VS 2022. What are the things I can reuse from the old version. Is there are any article/document which explains how to port the old VS extensions to newer versions of Visual studio ?
1 reply
Asaf Agami
@asaf92

Hi All,
I'm trying to write an integration test for a VSIX extension with the VsixTesting package, but I'm failing to simply load a solution or open the IDE without code. I'm stuck on the initial screen that shows recently opened projects.
I tried both IVsSolution2.OpenSolutionFile and DTE2.Solution.Open. In both cases it looks like something might be spinning in the background but I still see the initial welcome window and the IDE doesn't open.

How do you load a solution in a VS extension test?

modenamo
@modenamo
Hey! Does anybody know what is the correct way to provide automation objects from VSIX package, so they can be used in third-party applications with DTE COM interface?
I've added [ProvideAutomationObject("CustomObject")] to my interface and I'm able to get it from another side, but I'm unable to cast it to desire type. I've added [Guid] and [ComVisible(true)] attributes on interface and class, but still no effect.
Maybe the should be some configuration in VSIX or solution settings?
Mike Hershberg
@mhershberg
I'm having trouble debugging a menu command extension written using the Community Toolkit. If I set breakpoints anywhere they are disabled with the message "No symbols have been loaded for this document." Even executing the menu command itself still results in no breakpoints working. Is there something I can do to fix this?
6 replies
Mike Hershberg
@mhershberg
When I try to inspect a Community.VisualStudio.Toolkit.Project type variable the Visual Studio 2019 debugger says "<Internal Error Evaluating Expression>". Is this a known issue with the Community Toolkit or is something weird going on with my Visual Studio?
2 replies
agrael
@agrael:matrix.org
[m]

Hello, I'm making my first extension, an dI have several questions:
1) What property type is file path? I'd like to make a directory dialog and file dialog in properties window, for output logs.
2) How to hide properties depending on values from code? I have a map of files and I want a button to be available only if this file is present in this map, but BeforeQueryStatus with Command.Visible does nothing and command remains visible.
3) How do I make an invisible property?
4) How to query a command line from C++ project? I have a CLCCompiler, but it does not have a Command Line property embedded into its interface.

I'm using VS2022 Enterprise Preview the latest version

1 reply
agrael
@agrael:matrix.org
[m]

:point_up: Edit: Hello, I'm making my first extension, and I have several questions:

  1. What property type is file path? I'd like to make a directory dialog and file dialog in properties window, for output logs.
  2. How to hide properties depending on values from code? I have a map of files and I want a button to be available only if this file is present in this map, but BeforeQueryStatus with Command.Visible does nothing and command remains visible.
  3. How do I make an invisible option in the options menu?
  4. How to query a command line from C++ project? I have a CLCCompiler, but it does not have a Command Line property embedded into its interface.

I'm using VS2022 Enterprise Preview the latest version

1 reply
Crypties
@Crypties
Q: What's the easiest / best way you know to find the name of the current theme? I have yet to find how to easily retrieve settings from C# .. I haven't found any documentation about the available settings. I found myself going through a mounted hive registry (regedit) to explore what was there only to realize how little this was actually helpful. Am I missing something? With those different libs/tooling efforts (e.g. msft old and new, vsx community etc) I would guess something have been developed to make accessing settings easier, at least some documentation of those settings you can access by name/key?
I'd appreciate any help
Mac
@adityamehta13
Anyone can help me to understand "IVsProjectSelector " and how to use it.
Ghost
@ghost~62c432f86da0373984999439
I am able to add my extension in Universal Windows Basic App but not in simple C# Console Application. I have created an extension similar to the project in https://docs.microsoft.com/en-us/visualstudio/extensibility/walkthrough-creating-an-sdk-using-csharp-or-visual-basic?view=vs-2022 . Can anyone explain why?
Kuk!
@kuxvv:matrix.org
[m]
hi, have anybody figured out how to make the command arguments work via ProvideAppCommandLine() ?
Kuk!
@kuxvv:matrix.org
[m]
I mean I have added multiple params with ProvideAppCommandLine(), added <CommandFlag>AllowParams</CommandFlag> to the button but the cmdline.GetOption() still returns null
Kuk!
@kuxvv:matrix.org
[m]
I've realized it partially works, I can get parent arguments, those which are pass to the devenv. But I cannot get subcommand arguments.
so if I run "devenv /RootSuffix exp /Command "Tools.MyCommand /MySwitch" then I can only query /RootSuffix and /Command but not /MySwitch.
Ted
@fedorbirjukov
Hello, does anyone know why https://github.com/microsoft/VisualStudio-TestHost got archived? And what should be used instead now?
Asaf Agami
@asaf92

I have a strange situation in my extension:
Extensions depends on a NuGet package called Sentry. Sentry depends on System.Threading.Tasks.Extensions 4.5.4. When building, the System.Threading.Tasks.Extensions.dll doesn't get included in the vsix file. The problem is that on VS2017 the binding only redirects to an older version of this DLL leading to a missing assembly error.

Is this a bug in VS2017/MSBuild/NuGet/Whatever, or am I doing something wrong?

Crypties
@Crypties
Q: What's the easiest / best way you know to find the name of the current theme? I have yet to find how to easily retrieve settings from C# .. I haven't found any documentation about the available settings. I found myself going through a mounted hive registry (regedit) to explore what was there only to realize how little this was actually helpful. Am I missing something? With those different libs/tooling efforts (e.g. msft old and new, vsx community etc) I would guess something have been developed to make accessing settings easier, at least some documentation of those settings you can access by name/key?
Cl0uds1
@cvizzini

Hello, I'm making my first extension
I would like to add automatic comments on command above a specific line of code.
How do you get the cursor's previous line's position? aka the line above the cursor's positions so I can use the insert command?
`
var carat = docView.TextView.Caret.Position;
var position = carat.Value.BufferPosition.Position;
var cursorPrevLinePos = //TODO ??;

docView.TextBuffer.Insert(cursorPrevLinePos, "TEST123")
`

Daniel Sandberg
@bjorndaniel
I am re-writing an extension for VS 2022 and would like to know if there is a way to get which project a command was invoked from? I have a command that is under right-click on project and add (IDG_VS_CTXT_PROJECT_ADD_ITEMS) and when that command is invoked I would like to find out which of the projects in the solution this was invoked on.
1 reply
rhodosaur
@rhodosaur
Anyone know if it's possible to change the Solution Explorer icon for specific folders, e.g. like it's done for "Properties" in a C# project?
5 replies
Daniel Sandberg
@bjorndaniel
Anyone run into the issue when all of a sudden the breakpoints stop being hit and in the experimental instance it looks like the extension is installed but none of the commands or options are showing up?
12 replies
Vytautas
@vytkuklys
Hello, I am updating an old extensions on my VS2017. I would like to use FindToolWindowAsync method. So, I am inheriting from the PackageAsync class but it does not contain the mentioned method. What is a clean way to deal with this?
4 replies
Abishake968
@Abishake968
How do i get current Visual Studio theme from visual studio extension with c# language
Daniel Sandberg
@bjorndaniel
Where do you here go for ideas for new extensions? I really wanna do more but I struggle to come up with ideas, the ones I have done so far have been requests from co-workers...
2 replies
shanuwed
@shanuwed
Hi Is there a way to override the code being generated in VS using an extension when you right click a method and select "Create Unit Tests"? I want to plug in my own logic to generate a customized unit test instead of the stock code like "Assert.Fail()".
Abishake968
@Abishake968

How do i get current Visual Studio theme from visual studio extension with c# language

Anyone please do help for this

1 reply
Vyacheslav Avdeev
@lsoft

my turn to ask :( I need to bind something in MEF:

[Export(typeof(IA))]
public class AA : IA
{
    [ImportingContrustor] public AA([ImportMany] IA[] a) { ... } //there are other classes that implements IA and all of them are exported via its interface
}

it's not working: Loop involving ImportingContrustor argument and all non lazy imports... any ideas? (MEF is the horrible thing :( )

ssbarnea
@ssbarnea:matrix.org
[m]
I guess that this room is for VS classic and not VS code. Can someone recommend a similar room or forum for vscode extension developers?
sapsari
@sapsari
var solution = await AsyncServiceProvider.GlobalProvider.GetServiceAsync<SVsSolution, IVsSolution>();
if (solution.GetSolutionInfo(out string solutionDirectory, out string solutionName, out string solutionDirectory2)
                == VSConstants.S_OK)    

var solution = _package.GetService<SVsSolution, IVsSolution>();
if (solution.GetSolutionInfo(out string solutionDirectory, out string solutionName, out string solutionDirectory2)
                == VSConstants.S_OK)    
If there are multiple instances of VS are open, do both above retrieve the correct solution info?
sapsari
@sapsari
I did some manual tests, both seem to be working correctly
Vytautas
@vytkuklys
Hello there, I have noticed in many projects that people often call SwitchToMainThreadAsync within functions that call GetServiceAsync. I have tried to apply this "rule" and noticed that in some cases this leads to errors. My question is, is it in fact necessary to make sure that SwithToMainThreadAsync is called before all GetServiceAsync calls?
CyrusNajmabadi
@CyrusNajmabadi
I have tried to apply this "rule" and noticed that in some cases this leads to errors.
what errors does this lead to for you?
2 replies
Eugene Khoruzhenko
@sun2sirius
Hello folks, I am trying to use the "VSIX Project" template in VS2019 and VS2022 for project system extensibility, but it is not working per Microsoft's documentation (https://docs.microsoft.com/en-us/visualstudio/extensibility/extending-projects?view=vs-2022). I was able to get it calling the CreateProject method of SimpleProjectFactory, but then it returns "aborted" HRESULT: 0x80004004. Is this the right forum for this question? Can anyone give any pointers? Thanks
Abishake968
@Abishake968
How do i get a visual studio status bar height and width from VSIX. Please someone help me
Hemant
@hemantnavarkar
How to manage toolwindow layout programmatically? I want to save tool window dock style(Left,Right,Top,Bottom) and then want to open the tool window with the Same DockStyle Orientation. I am using VS2015 SDK (Isolated shell)
1 reply
Iconoclast Iceflow
@ccb18Vt_twitter
I'm looking for an example of adding a submenu to a menu in a VS 2022 extension.
I found this article: https://docs.microsoft.com/en-us/visualstudio/extensibility/adding-a-submenu-to-a-menu?view=vs-2022,
but there isn't enough context in the snippets for me to figure it out...
Any suggestions for an example? Thanks --
Jeff Lomax
@jefflomax
I have an extension targeting SSMS / VS 2019 using Community.VisualStudio.Toolkit.15 and .NET Framework 4.7.2, and code in another assembly created with .NET Core 3.1. IS it possible to reference the .NET Core, or does that all have to move to .NET Framework? Any example public repositories if can be done ? (I did try .NET Standard 2.0 and that also failed.)
SP
@sunilmpatel
Am trying to create custom debug engine for target running propritery operating system, as I understand I need to implement debug port wondering if there are any examples surrounding.
Eric Sink
@ericsink
I am trying to figure out how to prevent Visual Studio from putting a ProjectGuid into my project file. Like dotnet/project-system does, but I'm trying to figure out a minimal solution to the problem. For example, I tried adding an implementation of IProjectGuidStorageProvider, but that alone doesn't seem to be sufficient. I'm not sure what the difference is between that interface and IProjectGuidService. These interfaces don't seem to have much presence in docs or samples. Any tips?
Dan Neve
@DanForever
Hey guys, is https://github.com/microsoft/VSProjectSystem still maintained? Is there more relevant documentation for VS2019 (and VS2022) somewhere?
AraHaan
@AraHaan
Guys, is there a way to get all 4 different types of references from an EnvDTE.Project instance?
1 reply
  • A reference from a FrameworkReference (aka a being a library in one).
  • A reference from a PackageReference.
  • A reference from a ProjectReference.
  • A normal but manual library reference.
I am wanting to do an VS Extension that does things based on if a specific library is referenced in one of those ways and then do stuff if it is, else do nothing special.