Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
CyrusNajmabadi
@CyrusNajmabadi
Future plans for VS can't really be discussed.
yangdehua1981
@yangdehua1981
Hello everyone, how to get its warning level through a warning code?
Johan Larsson
@JohanLarsson
Not sure how you mean, do you ant default severity?
If so maybe source diving is the best way
Dan O'Brien
@InTheCloudDan
does Visual Studio provide out of the box APIs to store data in Credential Vault? I'm looking to have a Setting that stores an API key
Nathan H. Bean
@zombiepaladin
Is there a way of retrieving the user identity in an extension? I'm working on a student homework submission extension, and all our students have 360 accounts.
Neil Henderson
@bluetarpmedia
@InTheCloudDan @zombiepaladin Assuming you're writing C# VSIX extensions, you have access to the full .NET framework, plus Win32 via pinvoke. You can write code just like any desktop app.
@InTheCloudDan So you could use the Win32 Credential Management API or a wrapper like this nuget package: https://www.nuget.org/packages/CredentialManagement/
@zombiepaladin Maybe this will return what you need? Environment.UserDomainName
Dan O'Brien
@InTheCloudDan
thanks @bluetarpmedia !
yangdehua1981
@yangdehua1981
Hello everyone, how to get the coordinates of the code line
Matt Lacey
@mrlacey
@yangdehua1981 can you provide more context? Do you mean a Span within the document? or position relative to the editor window? or something else?
Vyacheslav Avdeev
@lsoft
what's the best and recommended way to install one specific nuget FROM my vsix? (I need to install one specific nuget to the project of opened solution from a Command in my vsix extension); any ideas are welcome!
Vyacheslav Avdeev
@lsoft
IVsPackageInstaller2? if so, it looks like there is no async version exists. should I run it from main thread?
jquery2005
@jquery2005
@lsoft Use the command to call and install nuget (nuget install) package address?
Vyacheslav Avdeev
@lsoft
@jquery2005 yeah, may be. or to prefer IVsPackageInstaller2? what's the recommended way? I don't know :)
I guess, VS-way looks preferable than the direct command...
Vyacheslav Avdeev
@lsoft
oh! thanks a lot, @SQL-MisterMagoo !
gbenshim
@gbenshim
Hi guys, i'm trying to figure out if its possible to set a default desiner (maybe default EditorFactory) per project type, i can see an example with ProvideXmlEditorChooserDesignerView, the registry keys that are being added to the pkgdef seem to be xml related. Is it possible to create a chooser like for a custom file type in a custom project? Any information would be appriciated! Thanks!
Yann Duran
@yannduran
@lsoft don't use System.Threading.ThreadPool.QueueUserWorkItem(), anymore, have a read of Cookbook for Visual Studio for more up-to-date ways of doing it
Vyacheslav Avdeev
@lsoft
how interesting!!! @yannduran thanks!
Yann Duran
@yannduran
@lsoft I hope you find it helpful
gbenshim
@gbenshim
Any lead in regards to a possible way to control the default editor, regardless or in regards to project type would be great
yangdehua1981
@yangdehua1981
@mrlacey I already know how to do it. Thank you for your reply
Jakub Míšek
@jakubmisek

Hi everyone - question about VSIX:

We're providing packages for Visual Studio 2017 and 2019 and upon installing it takes a long time to run, moreover, it installs other components than listed in our vsixmanifest (e.g. Microsoft.Net.Core.SDK.2.1 which frequently fails to install).

  • Is there a way to "debug" the VSIX?
  • How to make the installation faster/simpler, not invoking any downloads nor other packages installation?
Yann Duran
@yannduran
@jakubmisek to debug the VSIX, you simply press F5
Jakub Míšek
@jakubmisek
@yannduran I mean the installation process itself. We are Visual Studio partners and building Visual Studio extensions since 2005, but the new VSIX installer is magical
Yann Duran
@yannduran
Oh, not that I know of, no
Jakub Míšek
@jakubmisek
@yannduran thank you, although any idea would be appreciated :)
Yann Duran
@yannduran
@jakubmisek what's probably happening is one of the components listed in you vsixmanifest is dependent on elements that you haven't directly specified
Jakub Míšek
@jakubmisek

@yannduran this is our dependencies section of .vsixmanifest:

    <Dependencies>
        <Dependency Id="Microsoft.Framework.NDP" DisplayName="Microsoft .NET Framework" Version="4.6" />
        <Dependency IsRequired="false" Version="[15.0,16.0)" d:Source="Installed" Id="TestWindow.Microsoft.0771d463-d74d-4e95-aac2-39d3c7ec1f97" DisplayName="Test Explorer"/>
    </Dependencies>
    <Prerequisites>
        <Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[15.0,16.0)" DisplayName="Visual Studio core editor" />
        <Prerequisite Id="Microsoft.VisualStudio.Component.Web" Version="[15.0,16.0)" DisplayName="ASP.NET and web development tools" />
    </Prerequisites>

Not sure which one might cause VS to always attempt to install .NET Core SDK 2.1. It only happens on VS 2017 tho.

Yann Duran
@yannduran

for a start, you can get rid of the Microsoft.Framework.NDP dependency, it's not needed anymore - but it won't be the source of your problem though

it's possible that Microsoft.VisualStudio.Component.Web requires Microsoft.Net.Core.SDK.2.1 to be installed

Jakub Míšek
@jakubmisek
thanks! we'll try removing that. It's there basically since 2012 but now Web is always included, as well as .NET Framework always was.
Yann Duran
@yannduran
why is TestWindow.Microsoft.0771d463-d74d-4e95-aac2-39d3c7ec1f97 a dependency?
Jakub Míšek
@jakubmisek
it's a non-required dependency, since we integrate into Test Explorer. This weird dependency ID was taken from Python Tools for Visual Studio (https://github.com/microsoft/PTVS/blob/master/Python/Product/Core/source.extension.vsixmanifest)
Yann Duran
@yannduran
try without it maybe?
Jakub Míšek
@jakubmisek
so basically we'll try to remove all the dependencies, and check if it fixes it :)
Yann Duran
@yannduran
it's always best to not have anything in there that you don't know you need, especially when you're experiencing weird problems
Veselin Ivanov
@vvatkov
Anyone using IToolboxService? I use GetToolboxItems method to get WinForms toolbox items. However, the service does not work with .NET Core 3.1 items that are populated via a NuGet package. It there an alternative?
Jakub Míšek
@jakubmisek
@yannduran interestingly, vsix installer fails with System.AggregateException: One or more errors occurred. ---> Microsoft.VisualStudio.Setup.PackageFailureException: Package 'Microsoft.Net.Core.SDK.2.1' failed to install even if the vsixmanifest has no dependencies or prerequisites :) happens on some installations on VS 2017
Yann Duran
@yannduran

does it happen consitently on thos VS 2017 installations? you could try installing Microsoft.Net.Core.SDK.2.1 manually on one to see if that makes the problem go away

you might also like to file an issue through VS's Report a Problem button

Veselin Ivanov
@vvatkov

@yannduran interestingly, vsix installer fails with System.AggregateException: One or more errors occurred. ---> Microsoft.VisualStudio.Setup.PackageFailureException: Package 'Microsoft.Net.Core.SDK.2.1' failed to install even if the vsixmanifest has no dependencies or prerequisites :) happens on some installations on VS 2017

Similar error is reported to Visual Studio Community. So make sure you have the latest version of Visual Studio 2017. Also you can try repairing or completely reinstalling the instance.

Matt Lacey
@mrlacey
How/should I unsubscribe from events on IWpfTextView? As a specific example, I have an IntraTextAdornmentTagger based on the sample. This subscribes to events on the view passed to the tagger (https://github.com/microsoft/VSSDK-Extensibility-Samples/blob/346f5b0289e5fb8de639ba96fb10703df06cd22d/Intra-text_Adornment/C%23/Support/IntraTextAdornmentTagger.cs#L46) but these events aren't ever unsubscribed. Is this a problem? How/should I unsubscribe?
yangdehua1981
@yangdehua1981
Hello everyone, how to get its level according to compilation warning, for example: c4652 level is 1
Yann Duran
@yannduran
@mrlacey didn't Mads answer someone's question recently in oneof his youtube videos about unsubscribing from events? my recollection is that he said as long as you're not holding a reference to an event tat it'll just end up getting garbage collected, and that was ok
Matt Lacey
@mrlacey
@yannduran I remember something like that too. Just found a comment in my code with a todo saying "unsubscribe from these events" but not sure how. Transcripts from the videos @madskristensen does, would be really helpful for looking things like this up.
Matt Lacey
@mrlacey
Have now found https://github.com/madskristensen/MarkdownEditor/blob/master/src/Parsing/MarkdownDocumentView.cs which uses the TextView closed event to unsubscribe from the other events
Christopher Christou
@awschristou

I'm working on an extension that has a ToolWindow and a Team Explorer integration. If Visual Studio starts up with the Team Explorer panel visible and this extension's ToolWindow not visible, the Team Explorer portion of the extension initializes, but the main extension Package is not initialized until the ToolWindow is shown.

Is there a way to force activate the Package if needed when the Team Explorer code is activated?

Matt Lacey
@mrlacey
Try something like this to forcibly load a package

if (ServiceProvider.GlobalProvider.GetService(typeof(SVsShell)) is IVsShell shell)
{
    Guid PackageToBeLoadedGuid = new Guid(YourPackage.PackageGuidString);
    shell.LoadPackage(ref PackageToBeLoadedGuid, out _);
}