First live build against real Visual Studio/VSTO tooling surfaced two issues in the hand-written AddIn scaffold: ThisAddIn derived from the wrong base type (OutlookAddIn is an interface, not the concrete OutlookAddInBase class), and VSTO Application projects cannot build without a signed ClickOnce manifest, so SignManifests is now on with a throwaway self-signed test certificate. Both Core/Core.Tests/AddIn now build clean and Core.Tests passes. Also: mail always sent from Outlook's default account with no way to pick a different one (e.g. a shared mailbox) - added a "From account" setting (Session.Accounts dropdown in SettingsForm, SendUsingAccount in MailSender). And added deploy/ with both a local ClickOnce publish script (real install/uninstall via Windows Apps, no manual registry editing) and a manual registry sideload fallback for scripted rollouts. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
55 lines
1.7 KiB
C#
55 lines
1.7 KiB
C#
namespace BulkArchiveMailer.AddIn
|
|
{
|
|
/// <summary>
|
|
/// Static access point to the running add-in instance, matching the
|
|
/// shape Visual Studio normally generates for VSTO projects (hand
|
|
/// written here for the same reason as ThisAddIn.Designer.cs - see
|
|
/// its header comment).
|
|
///
|
|
/// <c>Microsoft.Office.Tools.Outlook.OutlookAddIn</c> has no static
|
|
/// "GetInstance" helper (it is just the FormRegion-related interface
|
|
/// implemented by the real base class, OutlookAddInBase) - the
|
|
/// running instance is instead captured directly by
|
|
/// ThisAddIn.Initialize() into <see cref="ThisAddIn"/> below, exactly
|
|
/// like the real VSTO-generated Globals class does via its
|
|
/// <c>Globals.ThisAddIn = this;</c> assignment.
|
|
/// </summary>
|
|
internal static class Globals
|
|
{
|
|
private static ThisAddIn _thisAddIn;
|
|
private static Microsoft.Office.Tools.Outlook.Factory _factory;
|
|
|
|
internal static ThisAddIn ThisAddIn
|
|
{
|
|
get { return _thisAddIn; }
|
|
set
|
|
{
|
|
if (_thisAddIn == null)
|
|
{
|
|
_thisAddIn = value;
|
|
}
|
|
else
|
|
{
|
|
throw new System.NotSupportedException();
|
|
}
|
|
}
|
|
}
|
|
|
|
internal static Microsoft.Office.Tools.Outlook.Factory Factory
|
|
{
|
|
get { return _factory; }
|
|
set
|
|
{
|
|
if (_factory == null)
|
|
{
|
|
_factory = value;
|
|
}
|
|
else
|
|
{
|
|
throw new System.NotSupportedException();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|