Visual Studio 2012 / AddinExpress 7.1 and Security Manager 7.0

Add-in Express™ Support Service
That's what is more important than anything else

Visual Studio 2012 / AddinExpress 7.1 and Security Manager 7.0
 
Thomas Lauer




Posts: 67
Joined: 2011-01-24
Hi, i want to convert a VS 2010 c# Projekt to VS 2012.
the project contains addinExpress and the security manager
when i compile the project the msbulid process hangs.

i have updated addinexpress and teh security manager to the actual version

sometime i recieve this message
Detailed technical information follows:
---
(Inner Exception)
Date and Time: 04.01.2013 20:42:04
Machine Name: TLAPC20120910
IP Address: fe80::c904:831f:2350:8923%11
Current User: GLSH\tla

Application Domain: DefaultDomain
Assembly Codebase: file:///C:/Program Files (x86)/Add-in Express/Add-in Express for .NET/Bin/Packages/VS2005/AddinExpress.Wizard.dll
Assembly Full Name: AddinExpress.Wizard, Version=7.1.4050.2005, Culture=neutral, PublicKeyToken=4416dd98f0861965
Assembly Version: 7.1.4050.2005

Exception Source: mscorlib
Exception Type: System.IO.IOException
Exception Message: Der Prozess kann nicht auf die Datei "C:\Users\tla\Desktop\CSharp-Projekte\Entwicklung\EMM2012\EMM2012\bin\Debug\EMM2012.dll" zugreifen, da sie von einem anderen Prozess verwendet wird.
Exception Target Site: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.

---- Stack Trace ----



(Outer Exception)
Date and Time: 04.01.2013 20:42:04
Machine Name: TLAPC20120910
IP Address: fe80::c904:831f:2350:8923%11
Current User: GLSH\tla

Application Domain: DefaultDomain
Assembly Codebase: file:///C:/Program Files (x86)/Add-in Express/Add-in Express for .NET/Bin/Packages/VS2005/AddinExpress.Wizard.dll
Assembly Full Name: AddinExpress.Wizard, Version=7.1.4050.2005, Culture=neutral, PublicKeyToken=4416dd98f0861965
Assembly Version: 7.1.4050.2005

Exception Source: AddinExpress.Wizard
Exception Type: System.Exception
Exception Message: The 'RegisterAssembly' function failed.
Exception Target Site: DoAfterBuild

---- Stack Trace ----
AddinExpress.Projects.Common.Registrator.DoAfterBuild(scope As vsBuildScope, action As vsBuildAction)
AddinExpress.Wizard.dll: N 0431 (0x1AF) IL


my os is windows 7 x64 and i have full admin rights

best regards
Thomas
Posted 04 Jan, 2013 13:44:49 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Thomas,

Please uncheck the 'Register for COM interop' option in the project properties and rebuild the project again.
Do you run Visual Studio in the 'As Administrator' mode (right click on the VS shortcut and choose 'Run as administrator')?
Posted 08 Jan, 2013 05:06:54 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
Hello Thomas,

This often occurs in VS 2010 and above if the solution contains two (or more) projects. I recommend that you re-check your add-in project: it should instantiate types from another project in event handlers, not in initializers and not in constructor. See also http://www.add-in-express.com/forum/read.php?FID=5&TID=11283.


Andrei Smolin
Add-in Express Team Leader
Posted 08 Jan, 2013 05:07:00 Top
Thomas Lauer




Posts: 67
Joined: 2011-01-24
uncheck the 'Register for COM interop' option in the project properties and rebuild the project again.
Do you run Visual Studio in the 'As Administrator' mode (right click on the VS shortcut and choose 'Run as administrator')?

This helps for compile for one compile process. the next hangs.

i have outlook 2013.
Posted 08 Jan, 2013 07:33:54 Top
Thomas Lauer




Posts: 67
Joined: 2011-01-24
i can send you the project.
Posted 08 Jan, 2013 07:37:10 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
Hello Thomas,

Please send me the project to the support email address (see readme.txt); please make sure the email contains a link to this topic.


Andrei Smolin
Add-in Express Team Leader
Posted 08 Jan, 2013 07:48:07 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
Hi Thomas,

Thank you.

You need to initialize static things see the region named "Globale Variablen" in an appropriate Office or Outlook event say, you can use the AddinInitialize event of the add-in module. Currently, they are created and initialized whenever you a) open the designer of the add-in module, b) register/unregister/rebuild the project, c) register/unregister the add-in.

The same applies to the form - don't use static initializers. Remeber that the code is run when you open the form designer.

An Outlook add-in isn't supposed to create new Outlook.Application instances. Note that using new ApplicationClass() in your code can cause security warnings when you access protected members of the Outlook object model; using OutlookApp property defined in the add-in module in many cases allows eliminate the need to use the Security Manager for Outlook.

If you need to get an Outlook.Application object in the code of the form, you should use this construct:
{add-in project name e.g. MyAddin1}.AddinModule.CurrentInstance.OutlookApp.


Andrei Smolin
Add-in Express Team Leader
Posted 08 Jan, 2013 09:04:48 Top
Thomas Lauer




Posts: 67
Joined: 2011-01-24
Hi Andrei,

Thank you for the fast help.

I use the code


        #region Globale Variablen

        private static ApplicationClass App = new ApplicationClass();
        private readonly SecurityManager sm = new SecurityManager();
        private readonly Logger _logger = LogManager.GetCurrentClassLogger();
        private readonly List<ActionClass> actionList = new List<ActionClass>();
        private Application OlApp = App;

        #endregion


when i remove the static

private ApplicationClass App = new ApplicationClass();


i recieve the error

can not access the non-static in a static contex

on Line
private Application OlApp = App;


best regards
Thomas
Posted 08 Jan, 2013 09:40:17 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
Comment out that line, too. In your code, use this.OutlookApp instead of App and OlApp.


Andrei Smolin
Add-in Express Team Leader
Posted 08 Jan, 2013 09:43:52 Top
Thomas Lauer




Posts: 67
Joined: 2011-01-24
Hi Andrei,

i remove the static and the lines
private Application OlApp = App; 

i uns only OutlookApp.

but i have the same problem :-(

with visual studio 2010 i don?t have this problem.

best regards
thomas
Posted 08 Jan, 2013 10:19:47 Top