Wednesday, September 24, 2008

Unresolved Externals when using POOM in VC++

I found several postings when searching for a solution to compiling a POOM app that errors out with Unresolved External Symbol CLSID_Application and IID_IPOutlookApp. Only one of the solutions I found worked for me using Visual Studio 2008 C++:

http://www.tech-archive.net/Archive/PocketPC/microsoft.public.pocketpc.developer/2006-03/msg00236.html


The trick is to use:

#include "initguid.h"
#include "pimstore.h"

at the begining of the .cpp file. The initguid.h is the item that fixes the problem.

Saturday, September 6, 2008

Incrementing FileVersion for VC++

In a recent posting, I talked about solutions to incrementing the FileVersion in Visual Studio .NET for VB.NET and C# project. This need was motivated by the changes in VS2008 that requires a FileVersion to be changed before the Windows Installer will replace a file.

Some of my projects have Native DLLs that are compiled in VS 2008's VC++ compiler. These files has the same problem with the installer, yet the previous solution (http://dotnetref.blogspot.com/2008/09/auto-incrementing-file-version-in.html) did not address.

I found this very handy Add-In that works well with VS2008 (and previous versions) that will increment the FileVersion (Product Version, etc.) in the VC++ projects resource file.

http://www.codeguru.com/cpp/v-s/devstudio_macros/visualstudionet/article.php/c14981

Friday, September 5, 2008

Visual Studio 2008 Setup Project always requiring .NET Framework 3.5 even when 2.0 is Targeted

I am slowly upgrading my projects from VS2005 to VS2008. I had a puzzling problem with the Setup Projects always requiring the .NET Framework 3.5 even when the Setup Project is targeted to 2.0 and the application it is delivering is using .NET Framework 2.0.

There are several posting on the the internet about solving this problem. It basically requires you to go to View/Editor/Launch Condition and change the .NET Framework to the version you desire. The Project properties for your setup project are a bit misleading when they have no affect on this problem.

Read these posting for more detailed explanations:

http://impressionsoft.blogspot.com/2008/03/visual-studio-2008-setup-project-and.html

http://blogs.msdn.com/cschotte/archive/2007/08/15/vs2008-launch-conditions-and-prerequisites.aspx

Thursday, September 4, 2008

Auto-Incrementing the File Version in Visual Studio 2005 and 2008

*** Update - Since I made this post, I have found another tool that is simpler to use and also work with VS2010. See this http://autobuildversion.codeplex.com/

If this doesn't work for you, then you may with to view the info below:

The Setup and Deployment (Windows Installer) has a significant change between VS2005 and VS2008. In VS2008, a file will not be updated by the installer if the File Version has not changed. This pretty much breaks all of the VS2005 Installations I have created. There are various reasons for this, and I will let you read for yourself:

http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.vstudio.general&tid=c4c56abf-9bde-45ed-8737-90cf90514d89&cat=&lang=&cr=&sloc=&p=1

The solution to the problem is to increment the File Version (under Project Properties/Assembly Information) between Setup (.msi) builds. So, before every setup you create, you have to go manually update the File Version so the setup will update the file. Before, you just had to update the Version property in the Installer Project (and let it update the Product Code); you still have to do this (which is probably acceptable). I thought there must be someway to automatically increment the File Version since this change to the Installer breaks all of my setups; however, there is not (that I can find anyway). The only workable solution I have found is to use a BuildTask that updates the AssemblyInfo.vb (or AssemblyInfo.cs) before each build is made. This solution is a really complicated for something that was a checkbox in VB6 (as someone pointed out).

Here is the solution I tried and it does work:

http://www.codeproject.com/KB/dotnet/Auto_Increment_Version.aspx

Here is a similar solution:

http://weblogs.asp.net/bradleyb/archive/2005/12/02/432150.aspx

Wednesday, September 3, 2008

Launch Internet Explorer or Default Browser from VB.NET (or C#)

I found several ways to launch IE from VB.NET, but the following approach appears to be the simplest:


Process.Start("IExplore.exe", "http://dotnetref.blogspot.com")


More information at:

http://bytes.com/forum/thread413370.html


If you want to launch the default browser (such as Firefox), it may be easiest to just say the following:

Process.Start("http://dotnetref.blogspot.com")


and let the Shell do the work of deciding th default browser.

For more info on this approach:

http://www.vbforums.com/showthread.php?t=323257


The C# approach is not any different, just use the approprate syntax.