hawbsl
hawbsl

Reputation: 16043

Can I avoid restarting Outlook as part of the change/test cycle for my VSTO AddIn?

We are developing a small Outlook plugin using VS2010 / VSTO.

It's a new thing for us so we're wondering what's possible and what's not possible in an Outlook plug-in versus our more familiar Winforms stuff. So we're making small piecemeal changes and checking frequently by running it in Outlook.

At the moment our change/test cycle works like this:

  1. In the Visual Studio IDE add, change, fix or extend the code in some small way
  2. F5
  3. Ding! Warning that Outlook is already running. Lose a life.
  4. Close Outlook
  5. F5
  6. Outlook starts, test the change

It's the restarting Outlook that makes it so slow.

Is there any way to debug without restarting Outlook? Or, what would be even better, is there any way to debug-and-continue?

If not, is there anything at all we can do to make this bit of dev a touch more fluent/faster?

Upvotes: 2

Views: 408

Answers (2)

Dinesh
Dinesh

Reputation: 2066

As far i know, We can't debug outlook while it is already running. Because it can't load our new DLL's until and unless you restart it.

As LachlanB said, We can use AppDomains to load the DLL dynamically and make it work with Outlook. Absolutely It will work, but we are taking control of loading our application's DLL into Outlook process.This might require some additional work on design and coding part. Normally this will be the job of Outlook to load addins DLL.

My Suggestion is, simply don't change your applications design and coding to enable debugging. It's not a best practice. Instead concentrate on, why your outlook is getting loaded very slowly?

You can try LachlanB's second suggestion on configuring outlook to load faster. use that steps to cleanup your outlook. You can also try discussion in MSDN forums http://social.technet.microsoft.com/Forums/en-US/exchangesvrclients/thread/a117fa73-8f19-4716-9603-eb756b609cd5

Upvotes: 0

Rocklan
Rocklan

Reputation: 8130

As far as I'm aware you can't make code changes and continue debugging. You need to reload Outlook so that it loads in the new DLL. You could always write your own code that monitors a particular DLL and loads it in real-time, eg

Assembly assembly = Assembly.LoadFrom("dllPath");
AppDomain.CurrentDomain.Load(assembly.GetName());
Type t = assembly.GetType("typeName");

Then you can work on your DLL, modify the code and re-load the thing with outlook still running. Probably more hassle than it's worth though.

Outlook 2007 is very quick to start on my machine (but I've got a beefy i5 machine) - it literally takes 2 seconds to open. If your Outlook is really slow to startup, consider doing the following:

  • Remove all of the other addins that you've got installed in Outlook.
  • Is it possible that you can detach from your current mailbox and only have an offline one?
  • Detach from all of your other mailboxes
  • Install more memory on your machine so that everything is cached (cheap option, memory is very cheap these days)
  • Close down all other apps on your computer
  • Setup your mailbox so that it's practically empty

Is Outlook itself taking ages to load? (Eg for the initial splash screen to go away) Or is it chugging away after it's opened?

Upvotes: 2

Related Questions