Quantcast
Channel: Visual Studio Integrate forum
Viewing all 4410 articles
Browse latest View live

Custom File Type Icons in Solution Explorer - Part 3

$
0
0

I've already posted a couple of threads (one and two) on this.

I have a custom editor for a file type hosted in Visual Studio. I want it to display with a custom icon in Solution Explorer.

I can create an item template for it (or just change the ProvideEditorExtension attribute ProjectGuid toone of these), but the custom icon (<VSTemplate><TemplateData><Icon> element in vstemplate file) only shows up in the Add New file dialog, not the Solution Explorer.

I know I could set the custom icon in a project system (or subtype/flavor), but I don't need a new project type. The tool I'm building targets an existing, widely used project type. I don't want users to have to create new projects using a different project type in the New Project dialog (and also migrate historical projects).

Even better, it would be nice to let the users add the custom editor to a variety of existing project types.  I can create multiple instances of the ProvideEditorExtension attribute with different ProjectGuids (one for each of the targeted project types), but again the attribute only shows up in the Add New file dialog, not the file node in Solution Explorer.

The options suggested so far in the previous 2 threads I submitted will not work partly due to difficulty with deployment.  I just need a simple VSIX deployment. TheVisual Studio Icon Patcher requires Visual to be closed down to be applied.  Plus it replaces existing icons, not add new ones.

Creating a project system/subtype/flavor seems to be the only possible option as discussed in this thread.  I went through this Walkthrough on project systems and successfully changed the icon of a file type in the Solution Explorer.  I modified the steps to work for a custom file icon instead of project icon.

I also took a look at this project subtype sample which is only available for VS 2010.  I don't know why this sample is not available in the 2013 SDK samples (assuming they didn't bother creating a new one - it won't work in 2013).

But again, apart from a project subtype/system having no VS 2013 samples, I don't want a new project type.  All I need is my custom editor files to show up using a different icon in the solution explorer.

Seems like an obvious thing that anyone creating a custom editor would want to do.

There may not be a workable solution to this, but I thought I'd bump it one more time anyway.  I might just have to live with the lame Notepad icon.


VSIX Deployment: VS Gallery Auto Updates Not Working

$
0
0

I followed these steps.

  1. Published extension (VS package) to the VS Gallery by uploading VSIX.
  2. Installed it to VS by selecting it from Extensions and Updates (experimental instance or normal instance).
  3. Incremented version number in source.extension.vsixmanifest.  1.3.23 changed to 1.3.24.
  4. Rebuilt VSIX and uploaded it again as a new version to existing tool page.  Nothing else changed, just the version number.
  5. Reopen VS, go to Extensions and Updates > Updates > Visual Studio Gallery

It does not list my extension for update.

Oddly, if I go to Extensions and Updates > Online > Visual Studio Gallery (after uploading new version), it shows the new version.  But it does not recognize it as an available update.

Return drop download URL from VSO Rest API

$
0
0

So I am able to pull in a bunch of build info by running the code below.  What code do I need to add to pull the drop download URL from the result?

using (HttpResponseMessage response = client.GetAsync(
                                "https://{accountname}.visualstudio.com/DefaultCollection/_apis/build/builds/{buildid}?api-version=1.0-preview.1").Result)
                    {
                        response.EnsureSuccessStatusCode();                     


                        string responseBody = await response.Content.ReadAsStringAsync();
                        Console.WriteLine(responseBody);




Add a group to ExceptionGroup

$
0
0

Hello,

For a custom debug engine I will need to add a new group to the exception dialog (ExceptionGroup interface on EnvDTE90)

The documentation @ http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.framework.server.grouprenameexception.grouprenameexception(v=vs.110).aspx states that custom debug engines can add groups, but its not explained how (and the interface only allows enumeration)

Does anyone have an idea on how to add a group?

Thanks and regards

Erik



VSPackage: Delay Signing for Obfuscation

$
0
0

I have an Addin that I am migrating to a VS package.  I need to obfuscate it.

With the Addin, I follow these steps successfuly.

  1. Delay signing (either using project properties or [assembly: AssemblyDelaySignAttribute(true)].
  2. Build the project (Release build)
  3. Obfuscate the dll using Dotfuscator
  4. Sign the obfuscated version using sn -Vr from a bat file.

With the VS package version, I can't get past Step 2 above.

To easily recreate the problem ...

  1. Create a new C# project of type Visual Studio Package
  2. Run through the wizard leaving defaults for everything
  3. Build the project successfully
  4. Go to Project Properties > Signing > check Delay Sign Only
  5. Attempt to rebuild

Fails with following error stack.

1>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\VSSDK\Microsoft.VsSDK.targets(761,5): error : CreatePkgDef : error : FileLoadException: Could not load file or assembly 'VSPackage13, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d9fa8bf4d64f08e0' or one of its dependencies. Strong name validation failed. (Exception from HRESULT: 0x8013141A)

1>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\VSSDK\Microsoft.VsSDK.targets(761,5): error : at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)

1>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\VSSDK\Microsoft.VsSDK.targets(761,5): error : at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)

1>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\VSSDK\Microsoft.VsSDK.targets(761,5): error : at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)

1>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\VSSDK\Microsoft.VsSDK.targets(761,5): error : at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)

1>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\VSSDK\Microsoft.VsSDK.targets(761,5): error : at System.Reflection.Assembly.LoadFrom(String assemblyFile)

1>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\VSSDK\Microsoft.VsSDK.targets(761,5): error : at Microsoft.VisualStudio.Tools.CreatePkgDef.ProcessAssembly(String fileName, Hive hive, PkgDefContext context, Boolean register, RegistrationMode mode) in f:\dd\VSSDK\VSIntegration\Tools\src\CreatePkgDef\CreatePkgDef.cs:line 205

1>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\VSSDK\Microsoft.VsSDK.targets(761,5): error : at Microsoft.VisualStudio.Tools.CreatePkgDef.DoCreatePkgDef(InputArguments inputArguments) in f:\dd\VSSDK\VSIntegration\Tools\src\CreatePkgDef\CreatePkgDef.cs:line 164

1>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\VSSDK\Microsoft.VsSDK.targets(761,5): error : at Microsoft.VisualStudio.Tools.CreatePkgDef.Main(String[] arguments) in f:\dd\VSSDK\VSIntegration\Tools\src\CreatePkgDef\CreatePkgDef.cs:line 85

1>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\VSSDK\Microsoft.VsSDK.targets(761,5): error : SecurityException:Strong name validation failed. (Exception from HRESULT: 0x8013141A)

How to stop the Visual Studio debugger without using DTE ?

$
0
0

I'm working in a VS 2010 SP1 Isolated Shell application. I need to ask the debugger to stop during a debug session. Currently I know two ways to do that:

- Using DTE: DTE.Debugger.Stop(...)

- Using the corresponding VS command: DTE.ExecuteCommand( "Debug.StopDebugging" )

But for internal reason, we try to not depend on DTE at all. So I would like to know if there is another way completely independent from DTE to stop the debugger ?

Ideally, I'm looking for a service interface more or less like IVsDebugLaunch which allow to ask the debugger to stop.


Solution.Open does not populate solution into recent projects and solutions list

$
0
0

Hi,

Ist it possible to open a solution programmatically and populate it to the "recent projects and solutions" submenu?

I am using Solution.Open() for this. The solution gets opened but it is not shown in the recent project submenu.

Visual Studio 2010 and Visual Studio 2012

Thanks,

Stefan

Check if a project already exists

$
0
0

Hi there,

I want to add an existing project to a solution within my package.

Is there a way to check if there's already a project with the same name in the same directory? I want to check this first before I ran into some exceptions.

Maybe there's a better way than to iterate all projects and compare the UniqeName or something.

Thanks,
Fabian


The Visual Studio Settings-Switcher! Visit http://visualstudiogallery.msdn.microsoft.com/a79072f7-3109-44a0-95c0-9c50e729d6a3


WPF dialog from a package centered to Visual Studio

$
0
0

Hi there,

I'm displaying a WPF dialog from my package. It should be centered to it's parent, the Visual Studio instance.

Is there a way to achieve this? I haven't found a way to get to an instance I can surpass the Show method.

Thanks,
Fabian


The Visual Studio Settings-Switcher! Visit http://visualstudiogallery.msdn.microsoft.com/a79072f7-3109-44a0-95c0-9c50e729d6a3

Cant add the folder in project dynamically in VSIX project

$
0
0

Hi,

I have one project template VSIX. In that VSIX having C# and Javascript project templates. I need to add one folder dynamically using the below code.

projectWizard.ProjectItems.AddFromDirectory(_projectPath + "\\sample");

Its working fine and added the folder in C# projects. But the Javascript projects does not add the folder correctly it throws the exception like below,

Destination directory 'C:\Users\Abbas\Documents\Visual Studio 2013\Projects\TabApplication8\TabApplication8\sample' already exists.

Please suggest how to add one folder in dynamically in Javascript project templates.

Thanks,

Abbas K


- Abbas K


Private Extension Galleries

$
0
0

Hi,

I have a question about private extension galleries. I have a development tool that is for use by our company only. Up until now, the tool was delivered as a VS add-in. The installation program was hosted on a network share and the update mechanism was simply checking a version file on the share with the current add-in version. However, since add-ins are being phased out, I have converted the tool to a VSIX extension. It works fine, but the delivery / update is where I am getting stuck. I cannot upload it to the main VS Extension Gallery since it is a tool internal to our company. The documentation for how to set up a private extension gallery is a little sparse to say the least. Am I correct in understanding that the gallery must be running on a web server? The documentation made it sound like it should work on a local file or share as well, but it didn't really say how...

Thanks

VSPackage: Provisional Text Highlight

$
0
0

Hello, I am working on feature for Visual Studio 2010+ where I need to show provisional (planned) selection.

I tried multiple ways using Markers, Taggers and ClassificationFormat and so on,
but those markers do not work correctly for me when they include linebreaks.

All what I need is to somehow show to user a transient block representing a new selection.
But without changing of current selection as it is too slow on large blocks (10k+ lines of code).
Selection also moves caret which is not wanted.

Colleague pointed me to ITextView.ProvisionalTextHighlight property of type ITrackingSpan,
but he also discovered the issue described below.

I tried to use it as:

var span = _buffer.CurrentSnapshot.CreateTrackingSpan(e.Pos, e.Length, SpanTrackingMode.EdgeExclusive);
_textView.ProvisionalTextHighlight = span;

It works perfectly, but a highlighted text is blinking in caret time interval.

What would you suggest to use for selection preview in VS2010+ ?

In other words, how do I show ITrackingSpan in same colors and form as editor selection does?

Thanks in advance.







VS Integration Package - ToolboxItem Custom object retrieve issue

$
0
0

Looking for the answers for the following threads.

https://social.msdn.microsoft.com/Forums/vstudio/en-US/e5c7e759-d6f3-4be1-9482-a96912d3e2e6/issues-in-editorwithtoolbox-samples-from-visual-studio-2008-sdk?forum=vsx

https://social.msdn.microsoft.com/Forums/vstudio/en-US/25b00974-57d3-44a5-a1e6-404aa8836221/vs-integration-package-how-to-programmatically-add-item-into-toolbox?forum=vsx

I am facing the same problem as stated in above Threads.

Thanks.

Regards,

Naga.

Add-ins removed in next Visual Studio version "14"

$
0
0

The documentation of Visual Studio 2013 stated:

"Visual Studio add-ins are deprecated in Visual Studio 2013. You should upgrade your add-ins to VSPackage extensions."

And in the next version Visual Studio "14" add-ins will be removed (the "Add-In Manager" menu item no longer exists). So, it is time to convert add-ins to packages.

Resources


MZ-Tools: Productivity add-ins for Visual Studio: http://www.mztools.com. My blog about developing add-ins: http://msmvps.com/blogs/carlosq/

VSPackages: How to change icon of buttons dynamically

$
0
0

Hello, 

I am developing a VSX package( this is VSCT in C# 4 and VS2010). I wants to add a button and change the button icon dynamically. I would like to know is there any way that I can change the icon of button dynamically?

Details:

1) First, I add a button in VSCT:

...

<Button guid="cmdSet" id="cmdID" priority="0x0101" type="Button"><Parent guid="cmdSet" id="commGroup"/><Icon guid="guidImages" id="cmdIcon" /><CommandFlag>DynamicVisibility</CommandFlag><CommandFlag>DefaultDisabled</CommandFlag><Strings><CommandName>My Button</CommandName><ButtonText>My Button</ButtonText><ToolTipText>My Button</ToolTipText></Strings></Button>

...


2) I add this button in .cs code

private initial()
{
   ...
    var cmdid = new CommandID(guid, cmdIDInt);
    var cmd = new OleMenuCommand(DoNothingMenuInvoke, cmdid);
    cmd.BeforeQueryStatus += new QueryButtonStatus;
    menuservice.AddCommand(cmd);
   ...
}

3. In QueryButtonStatus, I only can change the enable, checked, visible, property. I can find a way to change icon!

private void QueryButtonStatus(object sender, EventArgs e)
        {
            OleMenuCommand menuCommand = sender as OleMenuCommand;
            menuCommand.Checked = true;
            menuCommand.Enabled = true;
            menuCommand.Visible = true;

        }

4. BTW, as I know, there is a way to change the icon of button in VS toolbar. But this button is not in tool bar. Therefore, currently I have no idea and comes here for help.

Thank you all.







VS 2010 Extension Manager Online Gallery - Connection issue

$
0
0

I am trying to connect to VS 2010 Extension Manager Online Gallery but keep getting the following error:

A connection to the server could not be established because the following error occurred: The server has returned invalid data. Please try again later.

I've tried modifying the config to include below changes as specified in some blogs/forums. However, it's of no use. Can anyone suggest how to fix it. I'm using 10.0.30319.1 RTMRel version.

    <system.net>
      <defaultProxy useDefaultCredentials="true" enabled="true">
        <proxy usesystemdefault="True" />
      </defaultProxy>
        <settings>
            <ipv6 enabled="true"/>
          <servicePointManager expect100Continue="false" />
        </settings>
    </system.net>


--VG


not able to upload image by using visualstudio api-version=1.0-preview.2 API

$
0
0

URL : http://XXX.visualstudio.com//DefaultCollection/_apis/wit/attachments?fileName=abc.png&api-version=1.0-preview.2

Method is post

Header  that i pass

Content-Type application/json

in body

image byte is converted into base64 and pass this in body.

Response ::

{"id":"8a68d45b-8a48-4f09-b2b1-204dae830b50","url":"https://XXX.visualstudio.com/DefaultCollection/_apis/wit/attachments/8a68d45b-8a48-4f09-b2b1-204dae830b50?fileName=abc.png"}

After that when i download file from

https://XXX.visualstudio.com/DefaultCollection/_apis/wit/attachments/8a68d45b-8a48-4f09-b2b1-204dae830b50?fileName=abc.png

its not open it in my PC.

How visualstudio.com know that data is in base64 or plain?

As API http://www.visualstudio.com/en-us/integrate/reference/reference-vso-work-item-attachments-vsi#Uploadanattachment says that If file is binary then use a Base64 encoded string.

VSPackage: Command without menu, only with short cut

$
0
0

Hello,

in my VSPackage (C#, VS2013) I want to add a command that is available via a shortcut only. The shortcut must be set by the user via Tools -> Options -> Environment -> Keyboard

I have added an entry in the "symbol" section of the vsct file and matched the value of the id with an entry in the PkgCmdIDList. The package has the ProvideAutoLoad attribute.

I tried the following:

1. Adding no entry in the "button" section of the vsct file. This leads to the unfortunate result, that the command neither shows up in the options dialog (see above) nor in the menu, so it can not be executed at all.

2. Added an entry in the "button" section and addded the DefaultInvisible (in combination with the DynamicVisibility tag and without) tag to the button entry. This lets the command show in the options dialog, so I can add a shortcut and it hides the button from the menu. However, hitting the shortcut does not invoke the command - the event handler that was passed in the MenuCommand constructor is not called.

3. I removed the DefaultVisibility tag from the button and added the DynamicVisibility tag only. Then I changed the MenuCommand object into an OleMenuCommand object and added an event handler for the BeforeQueryStatus event. In that event handler I set the Visible property of the command to false. Now the shortcut works, however, the command button is also shown in the menu. The BeforeQueryStatus event handler is not called, until I chose the command button once in the menu. After that the event handler is called, the button is invisible and the shortcut still works.

3 is almost the solution except for the initial showing of the command button until I chose it once. Can anyone help?

Regards,

Marc

Restoring open documents and IVsProject3.ReopenItem.

$
0
0

We have a custom editor in an MPF-based project system and, until recently, the document window for our custom editor would be reopened upon opening the project, if the editor had been open when the project was closed. We updated our project system to more closely follow the Python Tools version of MPF and this behavior is now broken.  Our implementation of IVsProject3.ReopenItem (and other interfaces that would be related to this) seems unchanged, but, for some reason, the ReopenItem method is never called by the shell.  What other interfaces on the ProjectNode or WindowPane-derived class (or elsewhere) influence what the shell does here?

Thanks very much in advance.


Kirk Fertitta

VSPackages: How to change icon of buttons at run time

$
0
0

Hello, 

I am developing a VSX package( this is VSCT in C# 4 and VS2010). I wants to add a button and change the button icon dynamically. I would like to know is there any way that I can change the icon of button at run time?

Details:

1) First, I add a button in VSCT, this button isnot on a toolbar. The placement of this button is just like "Tools->Attach to Process" in Visual Studio:

...

<Button guid="cmdSet" id="cmdID" priority="0x0101" type="Button"><Parent guid="cmdSet" id="commGroup"/><Icon guid="guidImages" id="cmdIcon" /><CommandFlag>DynamicVisibility</CommandFlag><CommandFlag>DefaultDisabled</CommandFlag><Strings><CommandName>My Button</CommandName><ButtonText>My Button</ButtonText><ToolTipText>My Button</ToolTipText></Strings></Button>

...


2) I add this button in vspackag.cs:

private initial()
{
   ...
    var cmdid = new CommandID(guid, cmdIDInt);
    var cmd = new OleMenuCommand(DoNothingMenuInvoke, cmdid);
    cmd.BeforeQueryStatus += new QueryButtonStatus;
    menuservice.AddCommand(cmd);
   ...
}

3. In QueryButtonStatus, I only can change the enable, checked, visible, property. I can not find a way to change icon at run time ╮(╯_╰)╭

private void QueryButtonStatus(object sender, EventArgs e)
        {
            OleMenuCommand menuCommand = sender as OleMenuCommand;
            menuCommand.Checked = true;
            menuCommand.Enabled = true;
            menuCommand.Visible = true;

        }

4. BTW, as I know, there is a way to change the icon of button in VS toolbar. But this button is not in tool bar. Therefore, currently I have no idea and comes here for help.

Thank you all.










Viewing all 4410 articles
Browse latest View live