Change framework version of Shim project in VB.Net Outlook Shared Addin
-
Thursday, July 21, 2011 5:12 AM
I would like to change the Shim project framework version to version 3.5 to version 4.0. But when I goto Shim project properties there is no way of doing this.
Can anyone please advice me how I can change it.
Thank you.
Rajeshni Singh.
All Replies
-
Thursday, July 21, 2011 2:05 PMModeratorYou can't change the targeted Framework in the shim project. Delete the existing shim project and when you create a new one select the Framework version you can to use."Rajeshni singh" <=?utf-8?B?UmFqZXNobmkgc2luZ2g=?=> wrote in message news:c9300f4e-ef9f-4e96-aa2d-19e6965b26ca...
I would like to change the Shim project framework version to version 3.5 to version 4.0. But when I goto Shim project properties there is no way of doing this.
Can anyone please advice me how I can change it.
Thank you.
Rajeshni Singh.
Ken Slovak MVP - Outlook -
Thursday, July 21, 2011 9:11 PM
Thanks,
I have tried doing this. I removed the Shim project from my solution and added a new Shim project.
I specified .NET Framework 3.5 from the drop-down list on the New Project screen and selected "Addin Shim" for the type of project.
After creating the Shim project I checked the version again from properties and it is still saying:
Targeted framework: .NET Framework,Version=v4.0.
I do not understand why it doesn't say 3.5.
I have the following framework installed in my PC:
- Framework 4
- Framework 3.5 SP1
- Framework 3.0 SP2
- Framework 2.0 SP1
- Framework 1.1
Please advice what I can do to fix this.
Thank you for your help.
-
Friday, July 22, 2011 3:05 AM
I use Visual Studio 2010. I saw online that one cannot create a visual C++ project to have framework 3.5 and less with Visual Studio 2010. It will only support 4.0.
There are workarounds like mentioned in link below:
http://stackoverflow.com/questions/2921702/change-c-cli-project-to-another-framework-than-4-0-with-vs2010
I have tried the above and was able to compile the Shim dll successfully but when registered the Shim did not work properly.
After installing the MSI file that I created, I got runtime error in comm-addins when I tried to load the addin in outlook.
In comm-addins the addin displays the following message:
Not loaded. A runtime error occurred during the loading of the addins.
I suspect that while changing the Shim framework something went wrong.
Can you please advice me how I can correct this issue?
Thank you.
-
Friday, July 22, 2011 3:02 PMModeratorAs far as the load error, to see exactly what errors are being fired you need to enable Fusion logging. Fusion is the managed code loader. See http://blogs.msdn.com/b/vsod/archive/2008/04/22/troubleshooting-com-add-in-load-failures.aspx for information on how to set up and enable Fusion logging.What you might be running into is how the generated shim uses hosting interfaces. I think that Framework 3.5 still uses the CLR 1.0 hosting interfaces, Framework 4 uses CLR 4.0 hosting interfaces. That would mess things up.See if the information in Misha's blog article on the VS 2010 shim wizard helps with this, Misha is the author of the 2010 shim wizard (and with Andrew Whitechapel wrote the shim wizards). Misha's article is at: http://blogs.msdn.com/b/mshneer/archive/2010/03/19/com-shim-wizards-for-vs-2010.aspx"Rajeshni singh" <=?utf-8?B?UmFqZXNobmkgc2luZ2g=?=> wrote in message news:46006bbd-7dd9-4bfd-80fe-cd132d6f49b8...
I use Visual Studio 2010. I saw online that one cannot create a visual C++ project to have framework 3.5 and less with Visual Studio 2010. It will only support 4.0.
There are workarounds like mentioned in link below:
http://stackoverflow.com/questions/2921702/change-c-cli-project-to-another-framework-than-4-0-with-vs2010
I have tried the above and was able to compile the Shim dll successfully but when registered the Shim did not work properly.
After installing the MSI file that I created, I got runtime error in comm-addins when I tried to load the addin in outlook.
In comm-addins the addin displays the following message:
Not loaded. A runtime error occurred during the loading of the addins.
I suspect that while changing the Shim framework something went wrong.
Can you please advice me how I can correct this issue?
Thank you.
Ken Slovak MVP - Outlook -
Monday, July 25, 2011 4:25 AMThank you for you help Ken.
I found out through fusion logging that my Shim was not creating the issue.
Actually I have references to the following dll's in my project:
Interop.Microsoft.Office.Interop.Outlook.dll
Interop.Microsoft.Office.Core.dll
Extensilbility.dll
The problem is that the first two dll's are pointing in my debug folder of the main project.
I did add them as comm objects from project properties but they point to the debug folder after being added.
Extensibility.dll is pointing to C:\Program Files\Microsoft Visual Studio 10.0\Visual Studio Tools for Office\pia\Common
Due to these references, the project that I compile was not loaded properly since the above references were not found once installed. Extensibility.dll was only found if a PC had Visual Studio 10.0 installed.
Currently I just placed these three dll's in my installation folder and everything worked but I think it is not the right way.
Can you please advice me how to add the above three references in my project so that I will not need to add these manually to my installation file?
One more question: Can I use framework 4 for my shim project and framework 3.5 for my outlook project and ManagedAggregator project. Will it create any issues. Will it work on a PC that does not have framework 4?
Which framework would you advice me to use. Framework 3.5 or 4 since my aim is to cover most uses so that they would not have to install the framework as I read in some places that framework 3.5 addins will work with framework 3.5, 3.0 and 2.0. So I was thinking of using framework 3.5. Please advice. I really need to ensure that I use the most appropriate version of framework for my Outlook add-on.
Thank you so much for your help. -
Monday, July 25, 2011 1:36 PMModeratorYou are not supposed to deploy the official MS PIA's to your installation folder as that can lead to all sorts of versioning problems. Any deployments like that should be made to put the PIA's into the GAC (global assembly cache). That's normally done using bootstrappers to install the PIA's if necessary.If you read that blog piece I recommended by Misha you already know that you can't mix Framework versions. Your code and shim and aggregator and anything else all must use the same Framework version.If you go with Framework 4 you can embed any referenced PIA's and not have to deploy any of them. That's the major innovation and advantage of using Framework 4. Framework 3.5 would be more widely deployed most likely, but still isn't universal. Framework 3.5 includes Framework 2 and 3, so if you were to use Framework 2 it would work on installations where Framework 2 or 3 or 3.5 were there. But it doesn't work in reverse, if Framework 2 is installed and you use 3.5 then the user would still need to install 3.5.You have to evaluate not only what Framework version is most likely to be installed, but also the advantages and disadvantages of embedded PIA's and Framework 4 Client Profile installation, and also whether to even use VS 2010 or to go to VS 2008 where you can still use Framework 2 for your project."Rajeshni singh" <=?utf-8?B?UmFqZXNobmkgc2luZ2g=?=> wrote in message news:fd0236cc-5dda-4748-a169-708abcfae32b...Thank you for you help Ken.
I found out through fusion logging that my Shim was not creating the issue.
Actually I have references to the following dll's in my project:
Interop.Microsoft.Office.Interop.Outlook.dll
Interop.Microsoft.Office.Core.dll
Extensilbility.dll
The problem is that the first two dll's are pointing in my debug folder of the main project.
I did add them as comm objects from project properties but they point to the debug folder after being added.
Extensibility.dll is pointing to C:\Program Files\Microsoft Visual Studio 10.0\Visual Studio Tools for Office\pia\Common
Due to these references, the project that I compile was not loaded properly since the above references were not found once installed. Extensibility.dll was only found if a PC had Visual Studio 10.0 installed.
Currently I just placed these three dll's in my installation folder and everything worked but I think it is not the right way.
Can you please advice me how to add the above three references in my project so that I will not need to add these manually to my installation file?
One more question: Can I use framework 4 for my shim project and framework 3.5 for my outlook project and ManagedAggregator project. Will it create any issues. Will it work on a PC that does not have framework 4?
Which framework would you advice me to use. Framework 3.5 or 4 since my aim is to cover most uses so that they would not have to install the framework as I read in some places that framework 3.5 addins will work with framework 3.5, 3.0 and 2.0. So I was thinking of using framework 3.5. Please advice. I really need to ensure that I use the most appropriate version of framework for my Outlook add-on.
Thank you so much for your help.
Ken Slovak MVP - Outlook -
Tuesday, July 26, 2011 4:50 AM
Thank you Ken for your advice.
I was not on the right track, your last post really helped me.
I have decided to now use Framework 4.0.I am developing a shared com add-in which should be supported in Outlook 2010, 2007 and 2003. Hopefully framework 4 and Visual Studio 2010 will allow me to develop addins for Outlook 2003 as well..Will it?
Also Since I use Framework 4.0, I will not have to deploy any PIA to my end users machine. Does this also apply if I deploy my addin in Outlook 2003. Will it require me to deploy any PIA for Outlook 2003.
I know that the code for the shared addin that works in 2007 will work in Outlook 2010. Will I be able to compile the same code for Outlook 2007/2010 and 2003.
Is it possible to develop this addin in a way that I can use the same code for 2003 as well.
One more thing, I had Microsoft .Net Framework 4 (x86 and x64) added as prerequisite in my project. When I ran this setup in a PC that did not have Framework 4, I clicked on the Yes button on framework dialog box that appeared during installation to download framework and it took me to the Framework 4 Client Profile download instead of the full download. I checked all my framework version for all the projects in solution and it is for full. Do you have any idea whats wrong?
Thank you so much for your help.
Rajeshni Singh
-
Tuesday, July 26, 2011 1:27 PMModeratorIf you embed the PIAs you do not need to deploy them. You do have to be careful how you use the object model though.You will need to check the runtime version (Outlook.Application.Version) and if it starts with "11" that's 2003, "12" is 2007 and "14" is 2010. You can only use methods/properties and events that are there for that version. An attempt for example to call a method in 2010 from 2003 will crash Outlook. So you need to be very careful with your code.That said, I've done shared addins that way where the PIA is embedded and that support 2003 - 2010.The prerequisites and bootstrappers you add to your setup project must reference the Client Profile and not the full Framework for the correct version to be installed as needed.For a shared addin you need the shimming of course, and a setup project. For use with 2010 x64 you will need to compile your addin and managed aggregator for Any processor. Then you will need separate x64 and x86 versions of the C++ based shim project, and separate x86 and x64 versions of the setup project.Misha's blogs describe how to set up the x64 pieces. I've used that methodology to support not only 2003 - 2010, but also 2010 x64, all with one solution (with a total of 6 projects: addin, aggregator, x64 shim, x86 shim, x64 installer, x86 installer)."Rajeshni singh" <=?utf-8?B?UmFqZXNobmkgc2luZ2g=?=> wrote in message news:33cf99ba-c605-47c0-aa6a-54a1cbd67046...
Thank you Ken for your advice.
I was not on the right track, your last post really helped me.
I have decided to now use Framework 4.0.I am developing a shared com add-in which should be supported in Outlook 2010, 2007 and 2003. Hopefully framework 4 and Visual Studio 2010 will allow me to develop addins for Outlook 2003 as well..Will it?
Also Since I use Framework 4.0, I will not have to deploy any PIA to my end users machine. Does this also apply if I deploy my addin in Outlook 2003. Will it require me to deploy any PIA for Outlook 2003.
I know that the code for the shared addin that works in 2007 will work in Outlook 2010. Will I be able to compile the same code for Outlook 2007/2010 and 2003.
Is it possible to develop this addin in a way that I can use the same code for 2003 as well.
One more thing, I had Microsoft .Net Framework 4 (x86 and x64) added as prerequisite in my project. When I ran this setup in a PC that did not have Framework 4, I clicked on the Yes button on framework dialog box that appeared during installation to download framework and it took me to the Framework 4 Client Profile download instead of the full download. I checked all my framework version for all the projects in solution and it is for full. Do you have any idea whats wrong?
Thank you so much for your help.
Rajeshni Singh
Ken Slovak MVP - Outlook -
Wednesday, July 27, 2011 1:00 AM
Thanks Ken,
Why is it necessary to point to framework 4 Client Profile and not the full Framework? Does it really make much difference even if we want to point to Framework Full 4.0? The size of these files are not much different.Full is 48 MB and Client is 41MB.
I want to support both 32 bit and 64bit Outlook. At the end do we end up with only one MSI or two? Why do we need to have two setup projects?
Can't we have only one MSI that will support 32bit and 64bit both.
Misha only did the post for 64 bit and not both 32 bit and 64 bit.
How will I compile a dll for my main project that will be supported in 2003, 2007 and 2010. In which Outlook should I compile it? Is it 2003?Is it possible for you to provide me with a small sample in Visual Studio 2010 to show how the structure you mentioned above should be?
I am now confused as how I am supposed to compile only one dll that will work in Outlook 2010, 2007, 2003.I really appreciate the help you have provided me.
Thank you so much,
Rajeshni Singh.
-
Wednesday, July 27, 2011 2:27 PMModeratorYou can select the client profile or the full framework, but you have to be consistent. If your addin targets the client profile that's what must be installed, and vice versa with the full framework.How you set up the development machine depends on the version of Outlook being targeted. VS 2010 projects don't target Outlook 2003, you'd need to use VS 2008 or VS 2005 for that. In VS 2010 you can target either Outlook 2007 or 2010. That's with non-embedded PIA's, and in that case you'd need 2007 installed on the dev machine to target 2007.If you embed the PIA's then life is different. You use Framework 4 (either full or client profile) and can have your code running on 2003, 2007, 2010. Just make sure that you don't call a method or property not available in the runtime version of Outlook your code finds itself on. For example, PropertyAccessor was added in 2007. So if you use PropertyAccessor make sure first that you are running on 2007 or 2010.MSI projects can only target one processor. It's a limitation of the technology. You target your setup project to x86 and then you create another one that targets x64. You have to do the same for the shim project, one for x86 and one for x64. The managed code projects (addin and managed aggregator) are compiled for any and can run on either x86 or x64.All of those are in the same solution. You can set the configuration manager to compile the x86, x64 and Any projects all in one build. It's really pretty simple in practice.I don't have samples of that for VS 2010, sorry."Rajeshni singh" <=?utf-8?B?UmFqZXNobmkgc2luZ2g=?=> wrote in message news:71150b5a-5cf5-4ed7-8ffc-362c47dc64d2...
Thanks Ken,
Why is it necessary to point to framework 4 Client Profile and not the full Framework? Does it really make much difference even if we want to point to Framework Full 4.0? The size of these files are not much different.Full is 48 MB and Client is 41MB.
I want to support both 32 bit and 64bit Outlook. At the end do we end up with only one MSI or two? Why do we need to have two setup projects?
Can't we have only one MSI that will support 32bit and 64bit both.
Misha only did the post for 64 bit and not both 32 bit and 64 bit.
How will I compile a dll for my main project that will be supported in 2003, 2007 and 2010. In which Outlook should I compile it? Is it 2003?Is it possible for you to provide me with a small sample in Visual Studio 2010 to show how the structure you mentioned above should be?
I am now confused as how I am supposed to compile only one dll that will work in Outlook 2010, 2007, 2003.I really appreciate the help you have provided me.
Thank you so much,
Rajeshni Singh.
Ken Slovak MVP - Outlook -
Thursday, July 28, 2011 6:31 AM
Hi Ken,
Thank you for the response.
I tried following Mishas blog to compile a x64 version of my outlook add-in in Visual Studio 2010, Framework 4 with embeded PIA. I compiled this in my 32 bit operating system and took it to 64 bit operating system and installed my setup.
When I opened Outlook I could see the shim in the com-addin but it was not loaded. It gave runtime error on load.
I used Fusion logging to check this but it did not show any errors. Now I am not sure what to try to know the cause of this error.My project wont even run in debug mode. It would not connect to Outlook. My 64bit Shim was also made in my 32 bit enviornment.
Will that create any issues?I would really appreciate it if you could also advice me on how to debug these sort of issues. I tried making a object of my connect class in the VBA and it did not return any errors.
I really appreciate your help in helping me fix this issue.
Thank you,
Rajeshni Singh.
-
Thursday, July 28, 2011 1:39 PMModeratorI'm not sure what the problem could be.The test x64 system does have Office 2010 x64 installed on it, correct? The bitness of the OS is irrelevant of course, it's the bitness of the Office version that determines which installer to run. A 32-bit Office version on an x64 OS would still run the x86 installer.I use Win7x86 mostly as my dev system for developing on VS 2010 for Outlook 2010x64, so that's not the problem. In fact, if you were to install VS 2010 on Win7x64 it would be running in 32-bit mode anyway, as VS is still 32-bit.The addin dll project compilation is the same for 32 or 64 bit Outlook 2010. You just set it to compile for Any processor. The same applies to the Managed Aggregator project in the solution. Are both of those projects set up that way?For the setup projects, you should have 2. One would be for x86 and one for x64. Other than naming (MyAddinNameSetup or MyAddinNameSetupx64) the setups are identical in all but 2 settings. The x64 setup uses the primary output of the x64 shim project, and the x86 setup uses the primary output of the x86 shim project. The other difference obviously is that the x86 version has TargetPlatform set to x86 and the x64 setup has TargetPlatform set to x64.For the shims the only differences are what Misha discussed, where the platform is set to either the newly created x64 setting or the Win32 setting."Rajeshni singh" <=?utf-8?B?UmFqZXNobmkgc2luZ2g=?=> wrote in message news:c7eb55fb-08da-426e-b6a4-fe6e6b2c177e...
Hi Ken,
Thank you for the response.
I tried following Mishas blog to compile a x64 version of my outlook add-in in Visual Studio 2010, Framework 4 with embeded PIA. I compiled this in my 32 bit operating system and took it to 64 bit operating system and installed my setup.
When I opened Outlook I could see the shim in the com-addin but it was not loaded. It gave runtime error on load.
I used Fusion logging to check this but it did not show any errors. Now I am not sure what to try to know the cause of this error.My project wont even run in debug mode. It would not connect to Outlook. My 64bit Shim was also made in my 32 bit enviornment.
Will that create any issues?I would really appreciate it if you could also advice me on how to debug these sort of issues. I tried making a object of my connect class in the VBA and it did not return any errors.
I really appreciate your help in helping me fix this issue.
Thank you,
Rajeshni Singh.
Ken Slovak MVP - Outlook -
Monday, August 01, 2011 6:17 AM
Hello Ken,
My addin finally connected :-). Thank you so much for your help.
I went through Mishas blog to do this but I never added the any registry keys in my project. Misha said we have to add the CLSID and addin.connect key in the following blog:
http://blogs.msdn.com/b/mshneer/archive/2010/03/19/com-shim-wizards-for-vs-2010.aspxI did not add any registry key mentioned in the blog. Those keys are automatically created once the Shim is registered.
Please advice if I am on the right track and if it is OK that I did not add these keys to my project setup registry.Also I encountered that from 64bit dll you cannot create a object of type 32bit. We have a 32 bit dll that we register and later use methods from it by creating an object of it. But in 64 bit dll when creating an object of this class I get an error 429 ("ActiveX cant create object..."). Do we have to compile this 32 bit dll in 64bit as well?
Thank you so much for all your help.
Rajeshni Singh.
-
Monday, August 01, 2011 5:12 PMModeratorI do create the registry keys in HKCR for both the x86 and x64 versions of the shim. If it works for you not to create those keys in the shim project's ConnectProxy.rgs file that's up to you, but I'm not sure how that would affect supporting you if you do have any problems.I think if you're going to use an external DLL from the 64-bit addin that you're going to have to compile it as a 64-bit DLL."Rajeshni singh" <=?utf-8?B?UmFqZXNobmkgc2luZ2g=?=> wrote in message news:69eac1a5-c7d8-43c1-a576-ab94470f1518...
Hello Ken,
My addin finally connected :-). Thank you so much for your help.
I went through Mishas blog to do this but I never added the any registry keys in my project. Misha said we have to add the CLSID and addin.connect key in the following blog:
http://blogs.msdn.com/b/mshneer/archive/2010/03/19/com-shim-wizards-for-vs-2010.aspxI did not add any registry key mentioned in the blog. Those keys are automatically created once the Shim is registered.
Please advice if I am on the right track and if it is OK that I did not add these keys to my project setup registry.Also I encountered that from 64bit dll you cannot create a object of type 32bit. We have a 32 bit dll that we register and later use methods from it by creating an object of it. But in 64 bit dll when creating an object of this class I get an error 429 ("ActiveX cant create object..."). Do we have to compile this 32 bit dll in 64bit as well?
Thank you so much for all your help.
Rajeshni Singh.
Ken Slovak MVP - Outlook -
Tuesday, August 02, 2011 5:27 AM
Hi Ken,
I have added a new class library project to my solution. I later need to use methods of this new class from my main project.
I want to compile this dll and use it's object as "Set copyprotect = CreateObject("A40DotNetProject.CopyProtect")".
Where A40DotNetProject is my class that I want to create in my solution.
This new class library that I have added as a separate project is set to Register for COM Interop by ticking the checkbox in compile tab.
This dll only has 1 class file. And I have set it to compile under (Any CPU) platform.
I have added the primary output of this to my setup file and set the register property to vsdrpCOM.What happens is if I compile and deploy my setup in 32bit OS in Outlook 2010, this new class registers fine but when I compile my setup file for 64 bit and deploy in Outlook 2010 64bit, it does compile but does not register properly. When I open outlook my main dll cannot make an object ("Set copyprotect = CreateObject("A40DotNetProject.CopyProtect") of this new dll that I have created and deployed. It returns the Active x error 429.
Can you please advice why this is happening?I have set this new class library project to compile in the Any CPU platform but still it does not register properly in the 64bit machine.
Thank you for your help.
Rajeshni Singh.
-
Tuesday, August 02, 2011 1:45 PMModeratorI'm no COM expert, and this is getting a bit off-base for Outlook programming, but I don't think you're going to be able to handle things that way with the 64-bit version of your addin.I load subsidiary dll's without registration. Where I have COM dll's I usually just do something like this, if the dll exports the procedures I want to call:
ButtonImageLoader.
ButtonLoader loader = new ButtonImageLoader.ButtonLoader();That loads a dll named ButtonImageLoader and instantiates a "loader" object as a ButtonLoader() interface. That exposes a PushImageToClipboard() method which I can then call in my code.Another way of handling that would be to drop down to using PInvokes (Win32 API calls). You can use LoadLibraryW() to load the dll and GetProcAddress() to get a handle to an exposed method in the dll. That dll handle pointer can be used with Marshal.GetDelegateForFunctionPointer() to get a pointer delegate that can be cast to a delegate object declaration for the function call. Then when you're done with the dll you would call FreeLibrary() to release the object and memory for the object.That method is more powerful, it would let you set up class factories to instantiate objects and so on but it's far more complex to implement and if you mess something up you're responsible for memory leaks and unreleased pointers and so on. I use that method also quite often, for example when loading the Redemption dll into my code.
As far as testing what your runtime environment is if you need that, you can check IntPtr.Size. If it's 4 the code is running as 32-bit code, if it's 8 the code is running as 64-bit code."Rajeshni singh" <=?utf-8?B?UmFqZXNobmkgc2luZ2g=?=> wrote in message news:7fb5a785-8ad2-4b3a-8f0a-f1cc3c2eb606...Hi Ken,
I have added a new class library project to my solution. I later need to use methods of this new class from my main project.
I want to compile this dll and use it's object as "Set copyprotect = CreateObject("A40DotNetProject.CopyProtect")".
Where A40DotNetProject is my class that I want to create in my solution.
This new class library that I have added as a separate project is set to Register for COM Interop by ticking the checkbox in compile tab.
This dll only has 1 class file. And I have set it to compile under (Any CPU) platform.
I have added the primary output of this to my setup file and set the register property to vsdrpCOM.What happens is if I compile and deploy my setup in 32bit OS in Outlook 2010, this new class registers fine but when I compile my setup file for 64 bit and deploy in Outlook 2010 64bit, it does compile but does not register properly. When I open outlook my main dll cannot make an object ("Set copyprotect = CreateObject("A40DotNetProject.CopyProtect") of this new dll that I have created and deployed. It returns the Active x error 429.
Can you please advice why this is happening?I have set this new class library project to compile in the Any CPU platform but still it does not register properly in the 64bit machine.
Thank you for your help.
Rajeshni Singh.
Ken Slovak MVP - Outlook -
Wednesday, August 03, 2011 5:56 AM
Hi Ken,
I have tried to compile my external test.dll and added a reference to it in my main project. I later use this as otest = test.testclass. Where test is the dll I am referencing and the testclass is the class inside this dll.
When I run my project I get the error that the assembly needs to have a manifest file.
Can you please advice if I am on the right track to load an external dll(that I have created) in my project.Previously in 32 bit we made the external dll and registered it on the system and later used the "Set copyprotect = CreateObject("A40DotNetProject.CopyProtect")" method to make an object of it.
Similar thing works in Visual studio 2010 in 32 bit OS and Outlook 32 but but not in 64 OS and Outlook 2010 64 bit.
Above you mentioned "I load subsidiary dll's without registration". What is this. How do you load this dll in your project.
All I need to do is make an object of this external dll (that I have compiled separately) in my main project and use it.
Do you have any sample of this that works in Outlook 2010 64bit?
Can you advice how you added the redemtion dll to your project.
I need to make a dll in 64bit and register it somehow in the system that can be later used by any projects.Please advice.
Thank you.
Rajeshni Singh. -
Wednesday, August 03, 2011 1:49 PMModeratorFor Redemption, I use the RedmptionLoader classes that Dmitry created. He has code for C#, VB.NET and Delphi/Pascal. The classes are set up to decide at runtime what "bitness" the code is running under (32 or 64 bit) and to load the appropriate Redemption dll version.If you go to the download page for Redemption at http://www.dimastr.com/redemption/download.htm, you can scroll down to the bottom of the page and see a download for the loader classes. That's the easiest way to see what's going on."Rajeshni singh" <=?utf-8?B?UmFqZXNobmkgc2luZ2g=?=> wrote in message news:d07e6681-cf73-4cf9-beed-9208305b6b82...
Hi Ken,
I have tried to compile my external test.dll and added a reference to it in my main project. I later use this as otest = test.testclass. Where test is the dll I am referencing and the testclass is the class inside this dll.
When I run my project I get the error that the assembly needs to have a manifest file.
Can you please advice if I am on the right track to load an external dll(that I have created) in my project.Previously in 32 bit we made the external dll and registered it on the system and later used the "Set copyprotect = CreateObject("A40DotNetProject.CopyProtect")" method to make an object of it.
Similar thing works in Visual studio 2010 in 32 bit OS and Outlook 32 but but not in 64 OS and Outlook 2010 64 bit.
Above you mentioned "I load subsidiary dll's without registration". What is this. How do you load this dll in your project.
All I need to do is make an object of this external dll (that I have compiled separately) in my main project and use it.
Do you have any sample of this that works in Outlook 2010 64bit?
Can you advice how you added the redemtion dll to your project.
I need to make a dll in 64bit and register it somehow in the system that can be later used by any projects.Please advice.
Thank you.
Rajeshni Singh.
Ken Slovak MVP - Outlook -
Wednesday, August 03, 2011 10:09 PM
Hi ken,
I have managed to register my class and use it in my main project.
I made a silly mistake where my class was working when I compiled it under 64bit. But I had an old class in 32bit in my setup file by the same name which was overriding this new class when installed.The external dll works if you make it to register as Com Interop and compile under AnyCPU platform.
I can use the CreateObject method to make an object of this in my main project.Thank you so much for your help.
Apologies for any inconvenience caused.Rajeshni Singh.
-
Wednesday, August 10, 2011 5:08 AMHi Again Ken,
I am now trying to code for word as editor in Outlook 2003.
Previously with VB6 I used the word template - .dot file for word editor.
I was converting my code to VB.Net. What happens is I am able to use this same method to load template inorder to create buttons in the word inspector.
The problem I am facing is that previously in VB6, the global variables in Outlook session was not maintained in the word session due to which we wrote "WordEditorVariablesGet" and "WordEditorVariablesSet" methods to get global variables from Outlook session to word session and set it back from word to Outlook respectively.
This method worked in VB6 and managed to get all the global variables to the new session created by word editor but now it does not.
Can you please advice of anything that can help me maintain my global variables in Word Editor as well.
Thank you so much for your help.
Rajeshni Singh. -
Wednesday, August 10, 2011 3:29 PMModeratorI'm not exactly sure what settings you need to get and save/set?In Outlook 2007 and above the WordMail editor is a dll owned by Outlook that incorporates a subset of the editing functions of the full Word. This new WordEditor object is now running in-process with Outlook, whereas the old subclassed full Word ran in its own process.So I see no reason why settings from Outlook shouldn't be available when working with WordEditor, it's all in the same process.Please explain exactly what you need to get that you cannot get now with the 2007 and later setup."Rajeshni singh" <=?utf-8?B?UmFqZXNobmkgc2luZ2g=?=> wrote in message news:3b02e442-593a-4726-9dcc-ed2df3ffc241...Hi Again Ken,
I am now trying to code for word as editor in Outlook 2003.
Previously with VB6 I used the word template - .dot file for word editor.
I was converting my code to VB.Net. What happens is I am able to use this same method to load template inorder to create buttons in the word inspector.
The problem I am facing is that previously in VB6, the global variables in Outlook session was not maintained in the word session due to which we wrote "WordEditorVariablesGet" and "WordEditorVariablesSet" methods to get global variables from Outlook session to word session and set it back from word to Outlook respectively.
This method worked in VB6 and managed to get all the global variables to the new session created by word editor but now it does not.
Can you please advice of anything that can help me maintain my global variables in Word Editor as well.
Thank you so much for your help.
Rajeshni Singh.
Ken Slovak MVP - Outlook -
Wednesday, August 10, 2011 8:40 PM
Hi Ken,
I am trying to code for Outlook 2003.
Since word and outlook in 2003 runs in different process when using word editor I have to pass global variable from Outlook to Word.
Do you have any idea how this can be done in VB.Net Outlook shared addin?Thank you so much for your help.
Rajeshni Singh.
-
Thursday, August 11, 2011 1:46 PMModeratorSorry, I don't follow.Is this with separate COM addins for Outlook and Word?I always handle the WordMail 2003 functionality in my Outlook addins so there's no problem sharing variables, they're in the same addin. All I do is reference Word in the Outlook addin and then I use whatever Word functionality I need.In managed code you do have to handle the threading issues between the Word process and the Outlook process, because they are on separate threads. So when I call a Word function from the Outlook addin I synch the thread context to my main Outlook thread to I'm not calling into the object models from different threads.I usually grab the synchronization context for the Outlook thread in the addin startup code, after I prime the Windows message pump. I make sure the Outlook UI is started (an ActiveExplorer exists) and call System.Windows.Forms.Application.DoEvents() to make sure the message pump is running. Then I get the context like this, where _syncContext is a SynchronizationContext object declared at class level:if (_syncContext == null)
{
System.Windows.Forms.Application.DoEvents();
if (System.Threading.SynchronizationContext.Current != null)
{
_syncContext = System.Threading.SynchronizationContext.Current;
}
}Then, when I want to synch a call to an object model to the main addin thread I use something like this, where WordCall is the method that gets called on the main thread:System.Threading.
SendOrPostCallback callback = new System.Threading.SendOrPostCallback(WordCall); if (callback != null){
System.Threading.
SynchronizationContext context = Connect.SyncContext; if (context != null){
context.Send(callback, args);
}
}
"args" would be an array of arguments passed to the call."Rajeshni singh" <=?utf-8?B?UmFqZXNobmkgc2luZ2g=?=> wrote in message news:a7f8d74e-a5ef-4f1c-a66a-2f61d03e185f...Hi Ken,
I am trying to code for Outlook 2003.
Since word and outlook in 2003 runs in different process when using word editor I have to pass global variable from Outlook to Word.
Do you have any idea how this can be done in VB.Net Outlook shared addin?Thank you so much for your help.
Rajeshni Singh.
Ken Slovak MVP - Outlook -
Wednesday, August 17, 2011 4:27 AM
Hello Ken,
Thank you for your support in helping me develop addins for Outlook using VB.Net.
I am currently having issues with word editor. I was able to get the global variables successfully from the Outlook session to the word session.
I am using the following code when a button is clicked i word editor inorder to get the addin object that is in the outlook session so I can get its global variables.
***************************************Dim golApp
golApp= GetObject(, "Outlook.Application")addin = gApp.COMAddIns.Item("OutlookTemplate2ndAttempt.Connect")
objConnect = addin.ObjectobjConnect.WordEditorVariablesGet(gLicenced)
Set golApp = Nothing
Set addin= Nothing
Set objConnect = Nothing*****************************************
"WordEditorVariablesGet" function is in my connect class where the variable "gLicenced" passed in this function is set in the connection class.
What happens is that once the following line "golApp= GetObject(, "Outlook.Application")" is run, Outlook and Word do not quit properly. The Outlook.exe and Winword.exe processes are always stuck.I debugged and saw that when I close Outlook after the above code is run in word editor, the on_disconnection event never fires in the connect class.
Can you please advice what is going wrong?Thank you so much for your help,
Rajeshni Singh. -
Wednesday, August 17, 2011 7:55 PMModeratorThis thread's been going on so long that I've lost track of some things. So let's first of all establish the current working environment.What version of Outlook, of the PIA's, of the Framework?Where is the code running? Word addin, Outlook addin, standalone code, whatever?"Rajeshni singh" <=?utf-8?B?UmFqZXNobmkgc2luZ2g=?=> wrote in message news:c1919007-74b6-4908-8e21-876ebf85e004...
Hello Ken,
Thank you for your support in helping me develop addins for Outlook using VB.Net.
I am currently having issues with word editor. I was able to get the global variables successfully from the Outlook session to the word session.
I am using the following code when a button is clicked i word editor inorder to get the addin object that is in the outlook session so I can get its global variables.
***************************************Dim golApp
golApp= GetObject(, "Outlook.Application")addin = gApp.COMAddIns.Item("OutlookTemplate2ndAttempt.Connect")
objConnect = addin.ObjectobjConnect.WordEditorVariablesGet(gLicenced)
Set golApp = Nothing
Set addin= Nothing
Set objConnect = Nothing*****************************************
"WordEditorVariablesGet" function is in my connect class where the variable "gLicenced" passed in this function is set in the connection class.
What happens is that once the following line "golApp= GetObject(, "Outlook.Application")" is run, Outlook and Word do not quit properly. The Outlook.exe and Winword.exe processes are always stuck.I debugged and saw that when I close Outlook after the above code is run in word editor, the on_disconnection event never fires in the connect class.
Can you please advice what is going wrong?Thank you so much for your help,
Rajeshni Singh.
Ken Slovak MVP - Outlook -
Wednesday, August 17, 2011 8:05 PM
Hi Ken,
I am coding for Outlook 2010,2007 and 2003.
Using Framework 4. Embedded PIAs.I have an Outlook addin. It works fine with 2010 and 2007.
In Outlook 2003 only the word editor is giving issues right now.
I am using the following code when a button is clicked in word editor inorder to get the addin object that is in the outlook session so I can get its global variables.
***************************************Dim golApp
golApp= GetObject(, "Outlook.Application")addin = gApp.COMAddIns.Item("OutlookTemplate2ndAttempt.Connect")
objConnect = addin.ObjectobjConnect.WordEditorVariablesGet(gLicenced)
Set golApp = Nothing
Set addin= Nothing
Set objConnect = Nothing*****************************************
"WordEditorVariablesGet" function is in my connect class where the variable "gLicenced" passed in this function is set in the connection class.
What happens is that once the following line "golApp= GetObject(, "Outlook.Application")" is run, Outlook and Word do not quit properly. The Outlook.exe and Winword.exe processes are always stuck.I debugged and saw that when I close Outlook after the above code is run in word editor, the on_disconnection event never fires in the connect class.
Can you please advice what is going wrong?Thank you,
Rajeshni Singh. -
Wednesday, August 17, 2011 8:13 PMModeratorI'm not quite sure why you're setting up your code the way you are, and passing settings externally to the Outlook addin. Is there some requirement to run in Word?What I would do is declare a Word.Application object in a class, along with Document and whatever else you need. If you discover at runtime that you are on Outlook 2003 and that Inspector.IsWordMail = True then you get Inspector.WordEditor and instantiate an instance of your WordMail class. You pass the WordEditor object, which is after all a Word.Document object and in the constructor you use WordEditor.Parent (or Document.Parent if you've already instantiated the Document object) to instantiate a Word.Application object.That class is internal to your Outlook addin, so there's no need to pass global settings. You can just access them from the WordMail class as you would from any other class.If you don't need the Word.Application object, don't use it. Just use the minimum number of Word objects that you need for whatever you need to do."Rajeshni singh" <=?utf-8?B?UmFqZXNobmkgc2luZ2g=?=> wrote in message news:beac6e26-8fa7-4d7b-a6c9-3c1180129ec5...
Hi Ken,
I am coding for Outlook 2010,2007 and 2003.
Using Framework 4. Embedded PIAs.I have an Outlook addin. It works fine with 2010 and 2007.
In Outlook 2003 only the word editor is giving issues right now.
I am using the following code when a button is clicked in word editor inorder to get the addin object that is in the outlook session so I can get its global variables.
***************************************Dim golApp
golApp= GetObject(, "Outlook.Application")addin = gApp.COMAddIns.Item("OutlookTemplate2ndAttempt.Connect")
objConnect = addin.ObjectobjConnect.WordEditorVariablesGet(gLicenced)
Set golApp = Nothing
Set addin= Nothing
Set objConnect = Nothing*****************************************
"WordEditorVariablesGet" function is in my connect class where the variable "gLicenced" passed in this function is set in the connection class.
What happens is that once the following line "golApp= GetObject(, "Outlook.Application")" is run, Outlook and Word do not quit properly. The Outlook.exe and Winword.exe processes are always stuck.I debugged and saw that when I close Outlook after the above code is run in word editor, the on_disconnection event never fires in the connect class.
Can you please advice what is going wrong?Thank you,
Rajeshni Singh.
Ken Slovak MVP - Outlook -
Thursday, August 18, 2011 4:30 AM
Hi Ken,
I have been working on the above issue and got it solved. I found out that inorder to destroy the golapp object I need to call the following function:
Marshal.ReleaseComObject(golApp)
Previously I was just setting the golApp object to nothing and it was not Quitting Outlook properly. Now Outlook exists properly.Thank you for all your help,
Rajeshni Singh. -
Thursday, August 18, 2011 1:45 PMModeratorI still say that you are going about this in a worst case way, not at all what I would recommend. But if you're happy with it..."Rajeshni singh" <=?utf-8?B?UmFqZXNobmkgc2luZ2g=?=> wrote in message news:87d81347-aca7-4ff5-8b7f-dcd162028b01...
Hi Ken,
I have been working on the above issue and got it solved. I found out that inorder to destroy the golapp object I need to call the following function:
Marshal.ReleaseComObject(golApp)
Previously I was just setting the golApp object to nothing and it was not Quitting Outlook properly. Now Outlook exists properly.Thank you for all your help,
Rajeshni Singh.
Ken Slovak MVP - Outlook -
Monday, August 22, 2011 5:23 AM
Hello Ken,
I wanted to ask you about debugging with VB.Net.
I have noticed that when I make any change in my code I have to install it again inorder to make the debug stop on breakpoints. If I make a change in my code and do not install it again it will not stop on any breakpoints.
Can you please advice why this is happening?
Thank you,
Rajeshni Singh -
Monday, August 22, 2011 2:08 PMModeratorI have no idea, I assume it's the way things work. I see much the same thing if the changes are big enough."Rajeshni singh" <=?utf-8?B?UmFqZXNobmkgc2luZ2g=?=> wrote in message news:6f682853-5495-4c8f-bb7e-b0c69022feea...
Hello Ken,
I wanted to ask you about debugging with VB.Net.
I have noticed that when I make any change in my code I have to install it again inorder to make the debug stop on breakpoints. If I make a change in my code and do not install it again it will not stop on any breakpoints.
Can you please advice why this is happening?
Thank you,
Rajeshni Singh
Ken Slovak MVP - Outlook

