Note that there are some explanatory texts on larger screens.

plurals
  1. POVisual Studio 2010 Add-In Problem
    primarykey
    data
    text
    <p>I just created a Assembly and a Visual Studio Add-In like this:</p> <p><strong>At first, the assembly</strong></p> <ul> <li>File => New Project</li> <li>New Class Library</li> </ul> <p>After i have changed the content of the "Class1.cs" file to</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ClassLibrary1 { public class Class1 { public void Test() { Console.WriteLine("Wohooo!"); } } } </code></pre> <p><strong>And now, the Add-In</strong></p> <ul> <li>File => New Project </li> <li>Visual Studio Add-In</li> <li>Clicking through the Wizard</li> </ul> <p>After i have changed the content of the "Connect.cs" file to:</p> <pre><code>public class Connect : IDTExtensibility2, IDTCommandTarget { ... public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom) { // Adding a button to thet tools menu // i can provide the source if needed } public void QueryStatus(string commandName, vsCommandStatusTextWanted neededText, ref vsCommandStatus status, ref object commandText) { if (neededText == vsCommandStatusTextWanted.vsCommandStatusTextWantedNone) { status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled; } } </code></pre> <p><strong>If i call the new class from the Exec Method, nothing happens. (No debug break point get fired)</strong></p> <pre><code> public void Exec(string CmdName, vsCommandExecOption ExecuteOption, ref object VariantIn, ref object VariantOut, ref bool Handled) { Action action = GetAction(CmdName); if (CmdName == "MyAddin2.Connect.SampleAddin2") { new ClassLibrary1.Class1().Test(); Console.WriteLine(""); } Handled = true; } </code></pre> <p><strong>if not, it works!</strong></p> <pre><code> public void Exec(string CmdName, vsCommandExecOption ExecuteOption, ref object VariantIn, ref object VariantOut, ref bool Handled) { Action action = GetAction(CmdName); if (CmdName == "MyAddin2.Connect.SampleAddin2") { // new ClassLibrary1.Class1().Test(); Console.WriteLine(""); } Handled = true; } </code></pre> <p>But why ? What is the problem ? </p> <p>Thanks in advance!!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload