Error when Register or Unregister

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

Error when Register or Unregister
Installed Log4Net from NuGet, started logging error. 
Codernater




Posts: 24
Joined: 2012-01-20
My environment is
VS2015
VB.NET
Windows 10
Outlook Add-In Office 2016

Hi guys,
I have installed Log4Net NuGet Package.
Yesterday, I have done the testing after installed Log4Net all the tests were good, the error was being logged correctly.

Today, I published the project using Add-In Express Click Once (by right click on the project, go to add-in express then publish) I used click once deployment.

After I did that, I started getting an error every time I register the project again with Add-In Express.

Here is the error detail that I'm getting when I register or unregister.
Could you please advise?

Thank you

John



Detailed technical information follows:
---
(Inner Exception)
(Inner Exception)
(Inner Exception)
Date and Time: 9/9/2016 1:58:02 PM
Machine Name: MachineName
IP Address: fe80::4458:722f:5611:8feb%7
Current User: MyDomain\MyUserName

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=8.2.4371.0, Culture=neutral, PublicKeyToken=4416dd98f0861965
Assembly Version: 8.2.4371.0

Exception Source: OutlookIHAddIn
Exception Type: System.IO.FileNotFoundException
Exception Message: Could not load file or assembly 'log4net, Version=1.2.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a' or one of its dependencies. The system cannot find the file specified.

---- Stack Trace ----



(Outer Exception)
Date and Time: 9/9/2016 1:58:02 PM
Machine Name: MyMachine
IP Address: fe80::4458:722f:5611:8feb%7
Current User: MyDomain\MyUserName

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=8.2.4371.0, Culture=neutral, PublicKeyToken=4416dd98f0861965
Assembly Version: 8.2.4371.0

Exception Source: OutlookIHAddIn
Exception Type: System.TypeInitializationException
Exception Message: The type initializer for 'OutlookIHAddIn.AddinModule' threw an exception.

---- Stack Trace ----



(Outer Exception)
Date and Time: 9/9/2016 1:58:02 PM
Machine Name: MyMachine
IP Address: fe80::4458:722f:5611:8feb%7
Current User: MyDomain\MyUserName

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=8.2.4371.0, Culture=neutral, PublicKeyToken=4416dd98f0861965
Assembly Version: 8.2.4371.0

Exception Source: mscorlib
Exception Type: System.Reflection.TargetInvocationException
Exception Message: Exception has been thrown by the target of an invocation.

---- Stack Trace ----



(Outer Exception)
Date and Time: 9/9/2016 1:58:02 PM
Machine Name: MyMachine
IP Address: fe80::4458:722f:5611:8feb%7
Current User: MyDomain\MyUserName

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=8.2.4371.0, Culture=neutral, PublicKeyToken=4416dd98f0861965
Assembly Version: 8.2.4371.0

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

---- Stack Trace ----
AddinExpress.Projects.Common.Registrator.dteBuildEvents_OnBuildProjConfigDone(projectUniqueName As String, ProjectConfig As String, Platform As String, SolutionConfig As String, Success As Boolean)
AddinExpress.Wizard.dll: N 1224 (0x4C8) IL





[I]
Posted 09 Sep, 2016 13:25:15 Top
Codernater




Posts: 24
Joined: 2012-01-20
by the process of exclusion
I was able to figure out which line is throwing the exception when I register.
it was this line in the module AddInModule.vb

Public Shared log As log4net.ILog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)
Posted 09 Sep, 2016 13:27:14 Top
Andrei Smolin


Add-in Express team


Posts: 18829
Joined: 2006-05-11
Hello,

Declare it as:

Public Shared log As log4net.ILog

Initialize this variable in the AddinInitialize and OnRibbonBeforeCreate event; which of the events occurs first depends on the Office application, version and the way you start it.


Andrei Smolin
Add-in Express Team Leader
Posted 12 Sep, 2016 04:46:48 Top
Codernater




Posts: 24
Joined: 2012-01-20
Hi Andrei,
your answer solved my issue.
Thank you so much.
Posted 13 Sep, 2016 08:52:01 Top
Andrei Smolin


Add-in Express team


Posts: 18829
Joined: 2006-05-11
You are welcome!


Andrei Smolin
Add-in Express Team Leader
Posted 13 Sep, 2016 08:58:41 Top