Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / IDE / February 2006

Tip: Looking for answers? Try searching our database.

Outlook Add-in deployment

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mike Bernstein - 07 Dec 2005 17:34 GMT
I have just produced an Oulook Add-in in Visual Studio 2005 Tools for the
Microsoft Office System. It works fine from the
IDE using debug on my PC (with Outlook 2003) but I am having trouble knowing
what
I need to do to create the correct files for installation into Oulook 2003
on another PC and what those files should be. Between Debug and Release
output, I have all kinds of files in my VS project directories but which of
these do I need to put on my deployment CD and do I need other files from
somewhere else as well?

Mike Bernstein
"Gary Chang[MSFT]" - 08 Dec 2005 06:33 GMT
Hi,

>I need to do to create the correct files for installation into Oulook 2003
>on another PC and what those files should be. Between Debug and
>Release output, I have all kinds of files in my VS project directories
>but which of these do I need to put on my deployment CD and do
>I need other files from somewhere else as well?

In the case of a VS2005 wizard generated simple Outlook 2003 Add-in, its
corresponding Setup project would have already contained the dependency
files in its Detected Dependencies folder, you only need to uncheck the
"Exclude" mark of those items which have a red "Stop" mark.

On the other hand, if you used any private assembly or native DLLs in your
Add-in project, you may need to add those files to your setup project's
Application Folder(View\File System\Application Folder). By the way, since
you use the VSTO2005 to develop your Outlook Add-in, a .NET Framework
Version 2.0 Redistributable Package is required in your deployment CD.

Thanks!

Best regards,

Gary Chang
Microsoft Community Support
--------------------
Get Secure! ¡§C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp
&SD=msdn

This posting is provided "AS IS" with no warranties, and confers no rights.
Mike Bernstein - 08 Dec 2005 10:32 GMT
Many thanks, that seems to be the area that I needed to look at.

Mike Bernstein

> Hi,
>
[quoted text clipped - 29 lines]
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
Mike Bernstein - 08 Dec 2005 14:15 GMT
That is still not the answer. I have done as you say with the dependencies
and produced the setup and MSI files. I have installed Framework 2.0, the
Office PIAs and the Visual Studio Tools for Office runtimes on the other PC
but the add-in will not load into Outlook 2003 SP2 on that PC. When you look
in the Add-ins in Outlook, the Add-in is listed but not ticked.

As I say, the add-in works fine on the development PC when run from debug in
VS2005 but if I manually remove the add-in from Outlook on that PC and try
an install, the add-in fails to load properly on that as well. What am I
doing wrong?

Mike Bernstein

> Hi,
>
[quoted text clipped - 29 lines]
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
Mike Bernstein - 08 Dec 2005 20:59 GMT
Further to the above I have now tried a new Outlook add-in project: Just a
single line in Startup - MsgBox("Hello world"). I have cleared all the stop
marks in dependencies, built the solution in Debug and it runs OK from
VS2005 in Outlook. I then changed the build to Release, removed the existing
add-in from Outlook and installed using the Setup file. As before, the
add-in fails to load with a runtime error.

As before, the same thing happens on another PC (this one is Win 2000 the
development one is XP).

Mike Bernstein

> Hi,
>
[quoted text clipped - 29 lines]
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
"Gary Chang[MSFT]" - 09 Dec 2005 06:20 GMT
Hi Mike,

>..., built the solution in Debug and it runs OK from VS2005
>in Outlook. I then changed the build to Release, removed
>the existing add-in from Outlook and installed using the
>Setup file. As before, the add-in fails to load with a runtime error.

Would you please give us the detail error message about that runtime error,
by the way, if you add the Debug version Add-in to your setup package and
install it, does it work OK?

Thanks!

Best regards,

Gary Chang
Microsoft Community Support
--------------------
Get Secure! ¡§C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp
&SD=msdn

This posting is provided "AS IS" with no warranties, and confers no rights.
Mike Bernstein - 09 Dec 2005 14:28 GMT
There is no difference in behaviour between the Debug and Release versions
in the setup file. The Add-in is shown in the Com Add-ins dialog in Outlook
but is not ticked and an error at the bottom, where normally it would say
'Load at Startup', says: 'Not Loaded - A runtime error occurred during the
loading of the COM Add-in'.

I have a further observation. When I installed the Debug version I forgot
and left Outlook open. The installation did not object to this and when I
looked at Outlook the Com Add-ins dialog showed the Add-in as ticked and
'Load at Startup'. Operability could not be tested because Outlook had not
been re-started. On re-starting Outlook I was back as before, with the 'Not
Loaded' error. Once again, this behaviour was the same with both Debug and
Release versions.

Mike Bernstein

> Hi Mike,
>
[quoted text clipped - 22 lines]
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
Mike Bernstein - 09 Dec 2005 15:56 GMT
Further to the above I have been experimenting with various aspects and I
have concluded that this is a manifest location thing. If the registry
entries for 'manifest location' point to the build location, the Add-in
works. If the registry entries for 'manifest location' point to the install
location the Add-in will not load. The manifests in the 2 locations are
identical and I have a feeling that something should change in the
installation copy to identify its displacement. Is this reasonable? What do
you think? The text in the manifest is:

<assembly xmlns="urn:schemas-microsoft-com:asm.v1"
xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" manifestVersion="1.0">
 <assemblyIdentity name="Outlook test for deployment.dll" version="1.0.0.0"
/>
 <asmv2:entryPoint name="Startup" dependencyName="dependency0">
   <asmv2:clrClassInvocation
class="Outlook_test_for_deployment.ThisApplication" />
 </asmv2:entryPoint>
 <asmv2:dependency asmv2:name="dependency0">
   <asmv2:dependentAssembly>
     <assemblyIdentity name="Outlook test for deployment" version="1.0.0.0"
/>
   </asmv2:dependentAssembly>
   <asmv2:installFrom codebase="Outlook test for deployment.dll" />
 </asmv2:dependency>
</assembly>

Mike Bernstein

> Hi Mike,
>
[quoted text clipped - 22 lines]
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
Mike Bernstein - 09 Dec 2005 16:52 GMT
No, it is nothing to do with that. It is all to do with having to grant Full
Trust to the installation folder. When I granted Full Trust to my
installation folder, everything is fine. This raises another question: How
do I transfer this Full Trust on a CD for installation on another stand
alone PC?

Mike Bernstein

> Hi Mike,
>
[quoted text clipped - 22 lines]
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
"Gary Chang[MSFT]" - 10 Dec 2005 04:33 GMT
OK, Mike, it appears you would need to create a .NET Security policy(s) on
each client computer granting "Full Trust" for your VSTO 2005 Outlook
add-in's assembly.

Granting Full Trust Permissions to Interop and Dependent Assemblies [Office
2003 SDK Documentation]
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/stagsdk/htm
l/stconTrustIAs_HV01085046.asp

If you have more concerns about this issue, I suggest you post it to more
appropriate newgroups--Office Add-in and .net framework specific newgroups
, wish you'd get better and quicker help there:

microsoft.public.vsnet.vstools.office
microsoft.public.office.developer.com.add_ins
microsoft.public.dotnet.framework

Thanks for your understanding!

Best regards,

Gary Chang
Microsoft Community Support
--------------------
Get Secure! ¡§C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp
&SD=msdn

This posting is provided "AS IS" with no warranties, and confers no rights.
Mike Bernstein - 10 Dec 2005 09:50 GMT
I will look at your suggestions and at least I now know what the issue is.
Many thanks.

Mike Bernstein

> OK, Mike, it appears you would need to create a .NET Security policy(s) on
> each client computer granting "Full Trust" for your VSTO 2005 Outlook
[quoted text clipped - 28 lines]
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
"Gary Chang[MSFT]" - 13 Dec 2005 07:23 GMT
You are welcome, Mike, good luck!

Best regards,

Gary Chang
Microsoft Community Support
--------------------
Get Secure! ¡§C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp
&SD=msdn

This posting is provided "AS IS" with no warranties, and confers no rights.
dadou - 11 Feb 2006 03:17 GMT
There is a MyBlog vb sample on
http://msdn.microsoft.com/office/default.aspx?pull=/library/en-us/odc_vsto2005_t
a/html/odc_vstoOutlookMyBlog.asp


to register you can call caspol or
in it you will find a good vb sample (console app) that calls caspol.exe

here is a transalation of that in c#

using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using System.IO;

namespace NFOutlookSecPolicy
{
   class NFOutlookSecPolicy
   {
       private const string addinAssemblyName1 = "OLAddin.dll";

       private const string vstoNode = "VSTOProjects";
       private const string vstoNodeDescription = "OLAddinOutlook Solution
Sample for Microsoft Visual Studio 2005 Tools for the Microsoft Office
System.";

       private const string solutionSampleNode = "OLAddin";
       private const string folderNode = "OLAddinInstallation";
       private const string addinAssemblyNode = "OLAddin";

       static void Main(string[] args)
       {
           if (args.Length >= 2)
           {
               string installOrUninstallOption = args[0];
               string targetDirectory = args[1];

               // Create an instance of the security policy installer object.
               NFOutlookSecPolicy secPolInstaller = new NFOutlookSecPolicy();

               if (installOrUninstallOption.ToLower().Equals("install"))
                   secPolInstaller.InstallCASPolicy(targetDirectory);
               else if
(installOrUninstallOption.ToLower().Equals("uninstall"))
                   // The order of removal of nodes is in the reverse order
as the addition
                   secPolInstaller.UnInstallCASPolicy();
           }
       }

       private string GetFrameworkFolder()
       {

           string frameworkFolder =
Path.Combine(Directory.GetParent(Environment.GetFolderPath(Environment.SpecialFolder.System)).FullName, "Microsoft.NET");
           frameworkFolder = Path.Combine(frameworkFolder, "Framework");

           string version = "v" + Environment.Version.Major.ToString() +
"." + Environment.Version.Minor.ToString() + "." +
Environment.Version.Build.ToString();
           frameworkFolder = Path.Combine(frameworkFolder, version);

           return frameworkFolder;

       }

       private void InstallCASPolicy(string targetDirectory)
       {

           string frameworkFolder = this.GetFrameworkFolder();

           string allFilesInInstallationLocation =
Path.Combine(targetDirectory, "*");
           string addinAssemblyPath1 = Path.Combine(targetDirectory,
addinAssemblyName1);
           //string addinAssemblyPath2 = Path.Combine(targetDirectory,
addinAssemblyName2);

           string arguments = @"-u -q -ag """ + vstoNode + @""" -allcode
Nothing -n """ + solutionSampleNode + @""" - d """ + vstoNodeDescription +
@"""";
           this.AddRemoveSecurityPolicyNode(frameworkFolder, arguments);

           arguments = @"-u -q -ag """ + solutionSampleNode + @""" -url """
+ allFilesInInstallationLocation + @""" Execution -n """ + folderNode + @"""";
           this.AddRemoveSecurityPolicyNode(frameworkFolder, arguments);

           arguments = @"-u -q -ag """ + folderNode + @""" -url """ +
addinAssemblyPath1 + @""" FullTrust -n """ + addinAssemblyNode + @"""";
           this.AddRemoveSecurityPolicyNode(frameworkFolder, arguments);

           //arguments = @"-u -q -ag """ + folderNode + @""" -url """ +
addinAssemblyPath2 + @""" FullTrust -n """ + myBlogsAssemblyNode + @"""";
           //this.AddRemoveSecurityPolicyNode(frameworkFolder, arguments);

       }

       private void UnInstallCASPolicy()
       {

           string frameworkFolder = this.GetFrameworkFolder();

           string arguments = @"-u -q -rg """ + addinAssemblyNode + @"""";
           this.AddRemoveSecurityPolicyNode(frameworkFolder, arguments);

           arguments = @"-u -q -rg """ + folderNode + @"""";
           this.AddRemoveSecurityPolicyNode(frameworkFolder, arguments);

           arguments = @"-u -q -rg """ + solutionSampleNode + @"""";
           this.AddRemoveSecurityPolicyNode(frameworkFolder, arguments);
       }

       private void AddRemoveSecurityPolicyNode(string frameworkFolder,
string arguments)
       {
           ProcessStartInfo procStartInfo = new
ProcessStartInfo("caspol.exe");
           procStartInfo.CreateNoWindow = true;
           procStartInfo.WindowStyle = ProcessWindowStyle.Hidden;
           procStartInfo.WorkingDirectory = frameworkFolder;
           procStartInfo.Arguments = arguments;

           Process caspol = Process.Start(procStartInfo);
           caspol.WaitForExit();

       }

   }
}

here is a caller
1.bat

NFOutlookSecPolicy.exe install "C:\Program Files\XYZ\OLAddin"
pause

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.