Jasinski Technical Wiki

Navigation

Home Page
Index
All Pages

Quick Search
»
Advanced Search »

Contributor Links

Create a new Page
Administration
File Management
Login/Logout
Your Profile

Other Wiki Sections

Software

PoweredBy

Add-Ins in Visual Studio

RSS
Modified on Fri, Jul 09, 2010, 4:59 PM by Administrator Categorized as Visual Studio and Developer Tools

Common Error

If you get the error Unable to copy file "obj\Debug\MyAssembly.dll" to "bin\MyAssembly.dll". The process cannot access the file 'bin\MyAssembly.dll' because it is being used by another process, here's how to fix it.

Add the following text to the pre-build event command line (found in Project Properties).

{copytext|div1}
if exist "$(TargetPath).locked" del "$(TargetPath).locked"
if not exist "$(TargetPath).locked" move "$(TargetPath)" "$(TargetPath).locked"

Walkthrough

  • Change the following methods in your Connect class.

public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst,
    ref Array custom)
{
    InitAddIn(application, connectMode, addInInst);
}
//-------------------------------------------------------------------------------------------------
public void OnDisconnection(ext_DisconnectMode disconnectMode, ref Array custom)
{
    if (disconnectMode != ext_DisconnectMode.ext_dm_UISetupComplete)
    {
        DeleteToolbar();
    }

}
//-------------------------------------------------------------------------------------------------
public void QueryStatus(string commandName, vsCommandStatusTextWanted neededText, ref 
    vsCommandStatus status, ref object commandText)
{
    if(neededText == vsCommandStatusTextWanted.vsCommandStatusTextWantedNone)
    {
        bool bEnabled = true;
        bool bHidden = false;

        QueryStatus(commandName, ref bEnabled, ref bHidden);
        status = (vsCommandStatus)(
            vsCommandStatus.vsCommandStatusSupported 
            | 
            (bEnabled? vsCommandStatus.vsCommandStatusEnabled : 0)
            |
            (bHidden? vsCommandStatus.vsCommandStatusInvisible : 0)
            );
        return;
    }
}
//-------------------------------------------------------------------------------------------------
public void Exec(string commandName, vsCommandExecOption executeOption, ref object varIn, 
    ref object varOut, ref bool handled)
{
    handled = false;
    if(executeOption == vsCommandExecOption.vsCommandExecOptionDoDefault)
    {
        Execute(commandName, ref handled);
    }
}

ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam. Except where noted, all contents Copyright © 1999-2018, Patrick Jasinski.