Quantcast
Channel: NetOffice - MS Office in .NET
Viewing all articles
Browse latest Browse all 1741

Created Unassigned: Wrong namespace in created AddIn C# project [20708]

$
0
0
New AddIn C# project is created by NetOfficeDevelopperToolbox - VS Project Vizard.
"I want a custom Task Pane" option is selected.

Created project contains new class "TaskPaneControl" in namespace "MyAssembly" (namespace based on assembly name).

File TaskPaneControl.cs:
```
using System;
using System.Collections;
using System.Collections.Generic;
using System.Windows.Forms;

namespace MyAssembly
{
public partial class TaskPaneControl : UserControl
{
public TaskPaneControl()
{
InitializeComponent();
}
}
}

```

But file Addin.cs (TaskPaneControl class is used here) contains wrong namespace "MeinAssembly".

File Addin.cs
```
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using NetOffice;
using Outlook = NetOffice.OutlookApi;
using NetOffice.OutlookApi.Enums;
using Office = NetOffice.OfficeApi;
using NetOffice.OfficeApi.Enums;
using NetOffice.Tools;
using NetOffice.OutlookApi.Tools;

namespace MeinAssembly
{
[COMAddin("MyAssembly","Assembly Description",3)]
[GuidAttribute("C253A09E-A5B8-41AC-84AE-2B0F1BE5C553"), ProgId("MyAssembly.Addin")]
public class Addin : COMAddin
{
public Addin()
{
this.OnStartupComplete += new OnStartupCompleteEventHandler(Addin_OnStartupComplete);
this.OnConnection += new OnConnectionEventHandler(Addin_OnConnection);
this.OnDisconnection += new OnDisconnectionEventHandler(Addin_OnDisconnection);
TaskPanes.Add(typeof(TaskPaneControl), "Task Pane");
TaskPanes[0].DockPosition = MsoCTPDockPosition.msoCTPDockPositionRight;
TaskPanes[0].DockPositionRestrict = MsoCTPDockPositionRestrict.msoCTPDockPositionRestrictNoHorizontal;
TaskPanes[0].Width = 150;
TaskPanes[0].Visible = true;
TaskPanes[0].Arguments = new object[] { this };
}

#region IDTExtensibility2 Members

void Addin_OnConnection(object Application, NetOffice.Tools.ext_ConnectMode ConnectMode, object AddInInst, ref Array custom)
{

}

void Addin_OnStartupComplete(ref Array custom)
{

}

void Addin_OnDisconnection(NetOffice.Tools.ext_DisconnectMode RemoveMode, ref Array custom)
{

}

#endregion
}
}

```

Error is reported when trying to build the project.

Problem is solved by rename namespace "MeinAssembly" to "MyAssemly" in Addin.cs.

Viewing all articles
Browse latest Browse all 1741

Trending Articles