September 1, 2008
@ 11:47 AM

I hope everyone in California is planning to attend this years Central Coast Code Camp up in San Luis Obispo on 9/27 - 6/28. It's always a great time and lots of free training! I will also be selling a limited number of my latest book "David McCarter's .NET Coding Standards" at my sessions for $11, cheaper than the web site (no tax and shipping), please bring exact change.

I will be presenting the following sessions and I hope you will attend.

dotNetDave's .NET Utility Assembly (My First CodePlex Project)

 dotNetDaves .NET Utility Assembly.pdf (704.86 KB)

CodePlex site: http://www.codeplex.com/dotNetTips

Building Rich & Interactive Web Applications with ASP.NET AJAX Part 1

zip_icon.gif Building Rich & Interactive Web Applications with ASP.NET AJAX Part 1 - 20081.zip (1.05 MB)

Building Rich & Interactive Web Applications with ASP.NET AJAX Part 2 

zip_icon.gif Building Rich & Interactive Web Applications with ASP.NET AJAX Part 2 - 200812.zip (1.49 MB)

Why You Need .NET Coding Standards (2008)

Why You Need .NET Coding Standards-2008.pdf (941.06 KB)

Photos

Pictures: http://www.flickr.com/photos/davidmccarter/tags/centralcoastcodecamp/

Blog Post about 2007 Code Camp: http://blog.davidmccarter.net/2007/09/23/ThingsIveLearnedThisWeek.aspx


 
Categories: .NET | AJAX | ASP.NET | C# | Code Camp | Defensive Programming | Development | dotNetDave | VB.NET

August 15, 2008
@ 01:20 PM

Do you want to retrieve all the Exceptions, including the inner Exceptions when an Exception is thrown for logging purposes? Since they are not enumerable, I wrote a block of recursive code below that will do the trick.

    1 Function RetrieveAllExceptions(ByVal ex As Exception) As ObjectModel.ReadOnlyCollection(Of Exception)

    2    Dim exceptions As New Generic.List(Of Exception)

    3 

    4    If ex IsNot Nothing Then

    5       exceptions.Add(ex)

    6 

    7       If ex.InnerException IsNot Nothing Then

    8          exceptions.AddRange(RetrieveAllExceptions(ex.InnerException))

    9       End If

   10    End If

   11 

   12    Return New ObjectModel.ReadOnlyCollection(Of Exception)(exceptions)

   13 

   14 End Function

Tip Submitted By: David McCarter


 
Categories: Development | VB.NET

Getting command line parameters or seeing if they are present is not as easy as you would think. I whipped up some code to make this flexible and easy.

   Private Const ParameterPrefix As Char = "/"c
       
   Private Function GetCommandLineArgument(ByVal parameter As String) As String
      Dim paramValue = String.Empty
      For Each tempValue As String In System.Environment.GetCommandLineArgs
         If tempValue.Contains(ParameterPrefix + parameter + "=") Then
            paramValue = tempValue.Split(Char.Parse("="))(1).ToString().Trim()
            Exit For
         End If
      Next
      Return paramValue
   End Function
   Private Function CommandLineArgumentExists(ByVal parameter As String) As Boolean
      Dim exists = False
      For Each tempValue As String In System.Environment.GetCommandLineArgs
         If tempValue.Contains(ParameterPrefix + parameter) Then
            exists = True
            Exit For
         End If
      Next
      Return exists
   End Function
   Private Function GetCommandLineArgument(ByVal parameter As String, ByVal prefix As String) As String
      Dim paramValue = String.Empty
      For Each tempValue As String In System.Environment.GetCommandLineArgs
         If tempValue.Contains(prefix + parameter + "=") Then
            paramValue = tempValue.Split(Char.Parse("="))(1).ToString().Trim()
            Exit For
         End If
      Next
      Return paramValue
   End Function
   Private Function CommandLineArgumentExists(ByVal parameter As String, ByVal prefix As String) As Boolean
      Dim exists = False
      For Each tempValue As String In System.Environment.GetCommandLineArgs
         If tempValue.Contains(prefix + parameter) Then
            exists = True
            Exit For
         End If
      Next
      Return exists
   End Function

Usage:

 Debug.WriteLine(CommandLineArgumentExists("source"))
 Debug.WriteLine(GetCommandLineArgument("source", "-"))

Tip Submitted By: David McCarter


 
Categories: Development | VB.NET

June 1, 2008
@ 08:55 AM
Code

I hope everyone in southern California is planning to attend this years SoCal Code Camp up at University California San Diego on 6/28 - 6/29. It's always a great time and lots of free training! I will also be selling a limited number of my latest book "David McCarter's .NET Coding Standards" at my sessions for $11, cheaper than the web site (no tax and shipping), please bring exact change.

I will be presenting the following sessions and I hope you will attend.

dotNetDave's .NET Utility Assembly (My First CodePlex Project)

10:15 AM - Sunday, June 29, 2008 - Location: 141

zip_icon.gif dotNetDaves .NET Utility Assembly1.zip (1.11 MB)

CodePlex site: http://www.codeplex.com/dotNetTipsUtility

Building Rich & Interactive Web Applications with ASP.NET AJAX Part 1

8:45 AM - Saturday, June 28, 2008 - Location: 129

zip_icon.gif Building Rich & Interactive Web Applications with ASP.NET AJAX.zip (1.83 MB)

Building Rich & Interactive Web Applications with ASP.NET AJAX Part 2 

12:15 PM - Saturday, June 28, 2008 - Location: 129

zip_icon.gif Building Rich & Interactive Web Applications with ASP.NET AJAX Part 2 - 20081.zip (1.82 MB)

Why You Need .NET Coding Standards (2008)

1:45 PM - Sunday, June 29, 2008 - Location: 127

zip_icon.gif Why You Need .NET Coding Standards-20081.zip (2.86 MB)

Pictures and Video

Fullerton Code Camp - JAN 2008

Pictures from This Years Code Camp:

Pictures from past SoCal Code Camps:

Video from past Code Camps:

 


 
Categories: .NET | AJAX | ASP.NET | Code Camp | Csharp | Defensive Programming | Development | dotNetDave | News | VB.NET

January 18, 2008
@ 08:25 PM

I hope everyone in southern California is planning to attend this years SoCal Code Camp up at Cal State Fullerton on 1/26 -1/27. It's always a great time and lots of free training! My fav southern California band Killola will be playing again at the Geek dinner so make sure you arrive early on Saturday to grab one of the limited number of tickets available.

167020688v3_240x240_Front_Color-Black.jpg

I will be doing the following sessions and I hope you will attend.

dotNetDave's .NET Utility Assembly (My First CodePlex Project)

zip_icon.gif dotNetDaves .NET Utility Assembly.zip (614.15 KB)

Building Rich & Interactive Web Applications with ASP.NET AJAX Part 1

zip_icon.gif Building Rich & Interactive Web Applications with ASP.NET AJAX Part 1 - 2008.zip (1.39 MB)

Building Rich & Interactive Web Applications with ASP.NET AJAX Part 2 

zip_icon.gif Building Rich & Interactive Web Applications with ASP.NET AJAX Part 2 - 2008.zip (1.11 MB)

Why You Need .NET Coding Standards (2008)

zip_icon.gif Why You Need .NET Coding Standards-2008.zip (1.71 MB)

Pictures and Video

Fullerton Code Camp - JAN 2008

Pictures from This Years Code Camp:

Pictures from past SoCal Code Camps:

Video from past Code Camps:

 

 


 
Categories: .NET | AJAX | ASP.NET | Code Camp | Csharp | Development | dotNetDave | JavaScript | News | VB.NET

Today, during the keynote address at Microsoft TechEd Developers 2007, S. “Soma” Somasegar, corporate vice president of the Developer Division at Microsoft Corp., announced that Microsoft will release Visual Studio 2008 and the .NET Framework 3.5 by the end of November 2007. Visual Studio 2008 and the .NET Framework 3.5 enable developers at all levels to rapidly create connected applications that offer compelling user experiences for Windows Vista, Windows Server 2008, the 2007 Microsoft Office system, mobile devices and the Web. Soma also unveiled plans to open new opportunities for Visual Studio partners, as well as to deliver new tools and resources for developers, including a first Community Technology Preview (CTP) of the Microsoft Sync Framework and new capabilities for Popfly Explorer.

“The highly social and visual nature of the Web has fundamentally changed what users expect from all applications they interact with, regardless of whether it’s on a customer-facing Web site or Windows rich client application, or a desktop business application built using Microsoft Office,” said Somasegar. “Traditionally, organizations have been hard pressed to deliver the richer, more connected applications and services they need to boost productivity, drive revenue and stay ahead of the competition. With Visual Studio 2008 and the .NET Framework 3.5, it is easy for developers to use the skills they already have to build compelling applications that take advantage of the latest platforms.”

FWBS Ltd., Xerox Corp., Dell Inc. and K2 are just a few of the early adopter customers that are already experiencing the benefits of these releases. FWBS used Visual Studio, the .NET Framework and the Microsoft Office system to build an Office Business Application (OBA) for the law field. The application enables users to work within Microsoft Office — the tools they use every day — while also dramatically improving productivity and helping users respond quickly to changing business needs.

Xerox has also had early success developing applications with the new tools. “We’ve already seen significant advantages from using Visual Studio Team System 2008 and .NET Framework 3.5. With the first application we built, we easily saved 50 percent of the time and money it would have taken to create the same application with other tools,” said Eugene Shustef, feature design lead, Global Technology, Xerox. “That’s more than a savings to IT — it delivers a huge time-to-market advantage because it put the tool into the hands of our analysts six months sooner than they would have had it otherwise.”

Creating New Opportunities for Partners

Microsoft also announced plans to make additional investments in the Visual Studio partner ecosystem. In response to partner feedback and in order to provide better support for interoperability with other developer tools and cross-platform scenarios, Microsoft is today announcing plans to change licensing terms, no longer limiting partners to building solutions on top of Visual Studio for Windows and other Microsoft platforms only. This licensing change will be effective for the release of Visual Studio 2008 and the Visual Studio 2008 SDK.

“Integrating dynaTrace’s cross-platform application performance management and diagnostics product with Visual Studio has opened up additional commercial opportunities for our business and delivered a compelling solution for our customers. .NET and Visual Studio is a strategic platform for our business, and Microsoft’s additional investments in the partner ecosystem make it even more compelling,” said Klaus Fellner, senior director of product marketing at dynaTrace. “We’re looking forward to taking advantage of the new technology available with the launch of Visual Studio 2008 and the partner benefits available through the Visual Studio Industry Partner (VSIP) program.”

In addition, Microsoft announced plans to create a shared source licensing program for Premier-level partners in the VSIP program. The program will provide these partners with the ability to view Visual Studio IDE source code for debugging purposes, and simplify the process of integrating their products with Visual Studio 2008.

Tools for Today and Tomorrow

Microsoft also announced a number of additional resources for developers of all skill sets, enabling them to make the most out of their Microsoft tools investments to build great applications on the latest platforms:

The first CTP of the Microsoft Sync Framework demonstrates Microsoft’s ongoing investments in synchronization and builds on the synchronization functionality available in Visual Studio 2008. With Visual Studio 2008, developers can rapidly take advantage of offline synchronization capabilities to sync-enable applications and services easily with rich designer support. The Microsoft Sync Framework extends the support featured in Visual Studio 2008 to also include offline and peer-to-peer collaboration using any protocol for any data type, and any data store. This is part of Microsoft’s long-term commitment to providing synchronization for partners and independent software vendors that can embed the Sync Framework into their applications easily to create rich sync-enabled ecosystems that allow any type of data to follow their customers wherever they go.

A new release of Popfly Explorer will add new Web tools that provide Web developers and Popfly users an easy way to add Silverlight gadgets built in Popfly to their Web pages, as well as publish HTML Web pages directly to Popfly.

These latest releases are part of the broader Microsoft Application Platform, a portfolio of technology capabilities and core products that help organizations develop, deploy and manage applications and IT infrastructure. They also mark another major milestone leading up to the global launch of Windows Server 2008, Visual Studio 2008 and SQL Server 2008 on Feb. 27, 2008, in Los Angeles.

Product Information and Availability

Visual Studio 2008 and the .NET Framework 3.5 will be available by the end of November 2007. The .NET Framework 3.5 will also be available to end users via a free, optional download from Microsoft Update. A CTP of Microsoft Sync Framework is available today at http://msdn.microsoft.com/sync. Popfly Explorer is a hosted development environment available today at http://www.popfly.com/. More information about all of these releases is available at http://www.msdn.microsoft.com/vstudio.


 
Categories: .NET | Development | News | VS.NET

Yes, you heard that right, they are releasing the source code for the 3.5 framework later this year. For more info, go to: http://weblogs.asp.net/scottgu/archive/2007/10/03/releasing-the-source-code-for-the-net-framework-libraries.aspx

 


 
Categories: .NET | Development | News

As you can see .NET clearly beats out Java when creating n-tier applications. Check out the entire story by going to: http://msdn2.microsoft.com/en-us/vstudio/bb499684.aspx


 
Categories: .NET | Development | News

David McCarter's .NET Coding StandardThe second edition of this book (formerly VSDN Tips & Tricks .NET Coding Standards), is a consolidation of many of the .NET coding standards available today in one easy to read and understand book. It will guide any level of programmer or development department to greater productivity by providing the tools needed to write consistent, maintainable code.

The core of the book focuses on naming standards, how to order elements in classes, declaring methods, properties and much, much more. Code tips are even included to help you write better, error free applications. All code examples are shown in C# and VB.NET. I use this book just about
every day and I hope you will too.
-David McCarter

"David McCarter once again demonstrates his knack for pulling best practices into one cohesive unit with his new book. This book includes everything from how to set up your project to how to declare variables to how to use exception handling. It is a great place to start to build your own set of coding standards."
- Deborah Kurata 5/5/05

To order, go to: http://www.cafepress.com/geekmusicart.165478704


 
Categories: .NET | Books | Development | dotNetDave | News | VB.NET | Csharp

August 10, 2007
@ 11:54 AM

Consistently delivering high-quality technology solutions on time and on budget is challenging for any business. The Microsoft Solutions Framework (MSF) provides people and process guidance—the proven practices of Microsoft—to help teams and organizations become more successful in delivering business-driven technology solutions to their customers. MSF is a deliberate and disciplined approach to technology projects based on a defined set of principles, models, disciplines, concepts, guidelines, and proven practices from Microsoft. MSF version 3.0 updates the Team and Process Models, introduces three new Disciplines (Project Management, Risk Management, and Readiness Management), provides new whitepapers (available online), a new course (1846A: MSF Essentials), public and private MSF newsgroups, and a suite of templates. Moreover, better integration with the Microsoft Operations Framework (MOF) and industry project management standards plus a new MSF Practitioner Program strengthen Microsoft’s proven practices for delivering innovative technology solutions.

http://www.microsoft.com/technet/solutionaccelerators/msf/default.mspx


 
Categories: Development | dotNetDave | Link

August 9, 2007
@ 12:03 PM

San Luis Obispo will be holding a code camp on September 22nd, 2007. I will be attending and presenting. For more info go to: http://www.centralcoastcodecamp.com/

Articles/News:

http://www.sanluisobispo.com/business/story/134783.html

Code Camp on KCOY

My sessions will be:

Building Rich & Interactive Web Applications with ASP.NET AJAX

Presentation: AjaxSession091807.zip (875.6 KB)

Code Example: AjaxExample.zip (703.12 KB)

Why You Need .NET Coding Standards

Presentation: StandardsSession.zip (1.6 MB)

Pictures from the event: http://www.flickr.com/photos/davidmccarter/tags/cccc/


 
Categories: AJAX | Csharp | Code Camp | Development | dotNetDave | News | VB.NET

August 9, 2007
@ 12:01 PM

Phoenix will be holding another code camp on September 15th, 2007. I will be attending and presenting. For more info go to: http://desertcodecamp.com/

My sessions will be:

Building Rich & Interactive Web Applications with ASP.NET AJAX

Presentation: AjaxSession.zip (1023.53 KB)

Code Example: AjaxExample.zip (703.12 KB)

Why You Need .NET Coding Standards

Presentation: StandardsSession.zip (1.6 MB)

 


 
Categories: AJAX | Csharp | Code Camp | Development | dotNetDave | News | VB.NET

The Beta 2 release includes most of the products found in the Visual Studio product line. As with all prerelease software, we encourage you only to install these on a secondary machine, or in a virtual machine, as they are not supported by Microsoft Services support teams. MSDN Subscribers can also download these files from MSDN Subscriber Downloads. You can also go to:

http://msdn2.microsoft.com/en-us/vstudio/aa700831.aspx


 
Categories: .NET | Development | dotNetDave | Link | News | VS.NET

June 6, 2007
@ 11:56 AM

Resources for IT Professionals:

http://technet.microsoft.com/en-us/default.aspx


 
Categories: Development | dotNetDave | Link

December 15, 2006
@ 12:04 PM

At Microsoft Live Labs we bring scientists, engineers, entrepreneurs and the online community together to think about and build a better online world.

http://labs.live.com/


 
Categories: Development | dotNetDave | Link

July 27, 2006
@ 09:08 PM
Categories: Development

July 19, 2005
@ 12:03 AM

Web page to easily create a machine key for encryption:

http://www.eggheadcafe.com/articles/GenerateMachineKey/GenerateMachineKey.aspx


 
Categories: .NET | ASP.NET | Development | Security

SP2 includes a variety of improvements to the initial product release. Documentation for this release is provided in the SP2readme_lang.htm, which can be downloaded below or found in the Reporting Services installation directory after Setup is complete.


To view a list of the bug fixes in SP2, see Microsoft Knowledge Base article 889640.

Late-breaking information that was not available in time to be included in the readme file will be published on the Microsoft Product Support Services Web site in the Microsoft Knowledge Base article 889641.

To get a complete set of installation instructions, see Microsoft Knowledge Base article 842440.

Note: Service Pack 2 will require a reboot after installation. For more information, see Knowledge Base article 889641.

Click here to download.


 
Categories: Development

Port Reporter logs TCP and UDP port activity on a local Windows system. Port Reporter is a small application that runs as a service on Windows 2000, Windows XP, and Windows Server 2003.

On Windows XP and Windows Server 2003 this service is able to log which ports are used, which process is using the port, if the process is a service, which modules the process has loaded and which user account is running the process.

On Windows 2000 systems, this service is limited to logging which ports are used and when. In both cases the information that the service provides can be helpful for security purposes, troubleshooting scenarios, and profiling systems’ port usage.

Click here to download.


 
Categories: Development

With this 3rd party FrontPage add-in, you can create full-featured HTML help files as easily as making a Web site. Help Publisher can produce HTML Help 1.x and MS Help 2.0 format help files as well as publishing help topics to Microsoft Word for proofreading and the production of manuals. Automatically creates the help file’s table of contents from the web's navigation structure and can even create an expandable/collapsible JavaScript contents for website hosted help. Automatic index generation from keywords associated with each topic page. Simple inclusion of context sensitive help and ‘See Also’ menus. Easy import of existing HTML Help Workshop projects and a comprehensive help file and tutorial are provided.

Click here to download.


 
Categories: Development

January 26, 2005
@ 02:00 AM

Paderborn, Germany — 25 Jan 2005 — The joint value proposition between Microsoft and Wincor Nixdorf, focusing on Microsoft’s Smarter Retailing Initiative (SRI), has resulted in more than 15 major retailers, including Axfood, ICA, Metro Cash & Carry and Superdrug ordering a total of over 60,000 licences of BEETLE point-of-sale (POS) systems that use the Microsoft® Windows® XP Embedded operating system.

The decision to invest in new technology for the store and back office illustrates the growing view among European retailers that their existing POS solutions, many of which are between seven and 10 years old, are not able to perform the tasks that smart retailers deem essential, such as providing an enhanced consumer shopping experience.
Included among the benefits that retailers using Microsoft XP Embedded enjoy are enhanced performance at the checkout, with significant improvements in transaction times, and the opportunity to offer a consistent level of service, whether a customer is shopping in the store or online.

“The debate around which new point-of-sale system to select is shifting from being simply around the selection of a till device to tackling the much broader question of how to implement the best point-of-service offering,” said Dilip Popat, managing director, Retail Industry Solutions Unit for Microsoft Europe, Middle East and Africa (EMEA). “Retailers are being driven to upgrade their systems to take advantage of new technology that can provide better customer service, with lower total cost of ownership.”

To this end, Microsoft has been working closely with Wincor Nixdorf. According to Michael Schulte, head of software marketing for Wincor Nixdorf, any replacement hardware and software has to address value-added customer service scenarios and integrate multiple device formats such as self-checkouts and information kiosks, in addition to traditional checkout lanes.

As a result of customer and development partner feedback, Microsoft will soon be shipping a retail-optimised software platform, Windows Embedded for Point of Service, designed for easy setup, use and management of point-of-service systems. Wincor Nixdorf has been an early and active member of the Joint Development Program for Windows Embedded for Point of Service, which will be available in the first half of 2005.

“We are committed to supporting Windows Embedded for Point of Service and developing solutions that deliver greater value to retailers by allowing them to take advantage of their legacy systems, while providing plug-and-play functionality for retail device peripherals, which is the single most requested feature by retailers,” said Schulte.

As further evidence of this commitment to delivering greater value to retailers, Wincor Nixdorf will soon deliver its Store Communication Framework, a product that will simplify the connectivity and data management issues inherent in today’s retailing infrastructures. Key elements of Store Communication Framework will be built upon the Microsoft .NET platform and leverage the Microsoft enterprise connectivity toolset.

Wincor Nixdorf has also chosen Microsoft .NET as the platform for TP.net, its newest point-of-sale solution. “This decision was taken based on four key factors: the relative simplicity of developing, maintaining and extending solutions; the speed and effectiveness with which solutions can be deployed worldwide; the low cost of developing and modifying web services-based concepts, and the strength of our relationship with Microsoft as our technology partner,” said Schulte.

Windows Embedded for Point of Service and the Microsoft .NET Framework are core technologies within Microsoft’s Smarter Retailing Initiative, which provides an innovative, open standards-based approach that allows retailers to easily create next-generation point-of-service systems that connect the store to the consumer. These future systems will also support emerging technologies such as RFID and biometrics.


 
Categories: Development

The Microsoft® Windows® Installer is an application installation and configuration service. WindowsInstaller-KB884016-v2-x86.exe is the redistributable package for installing or upgrading Windows Installer. This revised package replaces the previously released redistributable package named "WindowsInstaller-KB884016-x86.exe" and adds the ability to install Windows Installer 3.0 on computers that are running the Windows 2000 Multilingual User Interface Pack (MUI).

For more information about the Windows Installer 3.0 redistributable, see KB Article 884016: Windows Installer 3.0 is now available.

Click here to download.


 
Categories: Development

January 20, 2005
@ 02:00 AM

Log parser is a powerful, versatile tool that provides universal query access to text-based data such as log files, XML files and CSV files, as well as key data sources on the Windows® operating system such as the Event Log, the Registry, the file system, and Active Directory®. You tell Log Parser what information you need and how you want it processed. The results of your query can be custom-formatted in text based output, or they can be persisted to more specialty targets like SQL, SYSLOG, or a chart.

Most software is designed to accomplish a limited numer of specific tasks. Log Parser is different... the number of ways it can be used is limited only by the needs and imagination of the user. The world is your database with Log Parser.

To download, click here.


 
Categories: Development

For the compete article on CNet, click here.
 
Categories: Development

I am starting this tale a week into my ordeal. While I might talk a lot about the shortcomings of the Windows Installer here, you might learn a few tricks too.

Since I am one of the very first users of Wise, I decided to use the latest copy that I have from them (since they were bought out by another company, I cannot get a hold of any newer versions) called Wise for Visual Studio .NET.  I did not want to use the installer that comes with Visual Studio .NET since I knew I would quickly run into issues with it.

Requirements

Both Wise and VS.NET will do a simple install your files and features with no issues. Wise has many more built in features than VS.NET has. However, my install has some additional requirements that I think are not that outrageous and should be simple to do. Here they are:

  • Edit a web.config and app.config file.
  • Install a SQL Server database.
  • Install IIS if it is not installed (okay, this is a big one). Warn the user this is about to happen and allow them to back out of the install.
  • Display a dialog based on a feature that the user has chosen.
  • Create a virtual directory in IIS.
  • Only install on Windows XP and Windows 2003.
  • Create a directory and set permissions.

Except for automatically installing IIS, I do not think any of these things should be that difficult. To me, they are just normal tasks that any normal .NET application needs to perform these days. Well none of these tasks is easy with the Windows Installer/Wise. Before I continue, I need to say that the Windows Installer team has taken something that is not that difficult and have made it horribly complicated and hard to understand and even harder to test and debug. While Wise helped in some of the tasks above, I believe that the real problem lies in the lack of robustness in the Windows Installer. I come from the old Wise Installer days that use a top down scripting way of doing things. After working with the Windows Installer for a week now, I wish it were more like that.

What the Windows Installer Can Do?

One of the requirements is that our application can only run on Windows XP or Windows 2003. The Windows Installer can check for these system requirements but in a very limited way. I can set it to say it does not support any version of Windows before XP (good), but when it comes to the Windows NT versions, it can either check for all or one specific version (bad). Therefore, unless I write some custom script later, I cannot say “Requires Windows XP or Windows 2003”. All the other system requirements work in the same way.

Update: It turns out you can check for specific Windows versions with the installer (just not with the Wise IDE), but it is very confusing. After reading some of the Apress book listed at the end of this article I found out that installer properties can be Boolean or hold an actual value!?!? Okay, I have never heard of this before. Here is an example:

If you want to see if the user is running some version of Windows NT, you can use this:

NOT VersionNT

If you want to check to see if the user is running Windows XP or higher, you would use this:

VersionNT >= 501

As I am writing this, I am struggling with displaying a dialog that gathers information about a database server (server name, user name and password) so that it will only display after the Select Feature dialog if a certain feature was selected. This basically boils down to using Windows Installer events (discussed more in the “Wise or not so Wise” below).

Editing Files

Okay, this to me is a no brainer, most installs needs to edit files like web.config files, log files etc. Well, the Windows Installer does not have this capability!?!?! You have to write an external DLL or EXE to do this (which is not easy if you want to get information from the installer) or in my case, I used the Wise Script Editor (which complies to an outside EXE). While the Wise scripting worked, it was not elegant. I wanted to take a value in my web.config file like “{dbserver}” and just replace it with the real database server name gathered from the user during the install. Well you cannot…. the (Wise) script only has the ability to replace an entire line of text in a file.

Another issue with editing installed files is when to do it! With the old scripting version of Wise, it was easy, you knew when the file was installed and you then could edit it. Well, the Windows Installer does not work like that. It has these different areas called “Interface”, “Immediate” and “Deferred”. Furthermore, in these areas it has calls that is makes like MoveFiles, InstallFiles, InstallFinalize and more. So at first glance, you would just implement the editing EXE after InstallFiles… right? Wrong! In the install script, InstallFiles is not actually executed until InstallFinalize is called. Actually, everything in the script between InstallInitialize and InstallFinalize actually is queued up and run when InstallFinalize is called. Very confusing. I am still trying to understand when the Immediate and Deferred calls are run. I also found out that some of the properties (internal variables) are not available at certain places, like in Deferred. Dang!

Installing SQL Server Database

The Windows Installer cannot install (run) SQL scripts to create a SQL Server database. Wise dose have a very cool feature called “SQL Server Scripts” that will not only run scripts for your but it will even recreated a database, data and all! This saved me a ton of time.

Install IIS

Here is the big requirement and I did not think that any install program would do this and I was correct. It took me awhile to figure out how to force an install of IIS but I did right before I gave up. To do the install, the Microsoft Unattended Install program (sysocmgr.exe) needs to be called. Simply call it from the install like this:

sysocmgr /i:%windir%\inf\sysoc.inf /u:c:\iis.txt /x

The iis.txt file (that you create and install) should look something like this:

[Components]
iis_common = on
iis_inetmgr = on
iis_www = on
iis_ftp = off
iis_htmla = on

There is more information about sysocmgr.exe and the format of this file on the Microsoft web site. The iis.txt file format above is for IIS 5.0. Here is the format for IIS 6.0:

[Components]
iis_common = ON
iis_inetmgr = ON
iis_www = ON
fp_extensions = OFF
iis_ftp = OFF
aspnet= ON

There is another thing to worry about after IIS is installed. If the .NET framework is already installed, then none of the mappings in IIS for .NET pages like .aspx, .asmx etc. will be there. Therefore your ASP.NET applications and web services will not work.

To create the mappings the aspnet_regiis.exe program will need to be used (which is located in the latest version of .NET framework directory). However, this is not as easy as you might think. First, you need to figure out where the latest version of .NET is installed. This is the issue. There is a registry key called:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework
Value Name: InstallRoot

Which will bring back “C:\WINDOWS\Microsoft.NET\Framework\”. From there it is difficult from the registry to figure out what is the latest version that is installed. I just gave up (for now) and hard coded it to the version of the framework we are supporting (v1.1.4322). (If anyone knows of a better way, please let me know)

Call aspnet_regiis.exe like this:

C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_regiis.exe -s W3SVC/1/ROOT/MyWebService

This “-s” switch will make the mappings only for the specified web site (I like this switch because this does not mess with other web sites that could have different mappings). The second parameter is of course the path to the web site.

Another thing to worry about is that with IIS 6.0, due to security reasons ASP.NET page extensions are not enabled by default. The only way I could find to do this automatically is with this VB script:

Set IIsWebServiceObj = GetObject("IIS://localhost/W3SVC")
' Enable ASP.NET
IIsWebServiceObj.EnableWebServiceExtension "ASP.NET v1.1.4322"
IIsWebServiceObj.SetInfo

Now that I have listed all the gotcha’s, the order in which these are done (as I have found out the hard way) is very important. Here they are:

1. Right before CreateFolders in the Execute Immediate section

a. Install IIS.

b. Also run aspnet_regiis.exe with the “-ir” switch (this was very critical for our install because during CreateFolders a folder is created that the ASPNET user is given access too. If aspnet_regiis.exe is not run, then this user could not exist on the machine!)

2. After your virtual directories are created in the Execute Deferred section

a. Run the VB Script that enables the ASP.NET page extensions in IIS 6.0.
b. Then run aspnet_regiis.exe as described above so that the ASP.NET pages are mapped to your web application.

Interact With The User/ Display A Dialog

As you have read, I need to install IIS if it is not there already. In the actual wsi script, I wanted to display a yes/no message box to make sure the user wants to install IIS. Well you cannot do this in the Windows Installer (not from what I could figure out). The Windows Install can display a message, but that is it. Again, I looked to the Wise Script for help. It can display yes/not message boxes and use that as the beginning of an “if” statement. Score! Well this would not work… I wanted to give the user the ability to abort the installation (because without IIS the feature they selected would not work). The problem is that the Wise Script cannot return to the install an exit code that would abort the install.

Create A Virtual Directory In IIS

Again, the Windows Install does not have the capability to create a virtual directory in IIS. Wise does and it works great.

Create A Directory And Set Permissions

While this was not easy to find in Wise, the Windows Installer can do this. It took a learning curve to get it right because the Wise documentation was not that good and an article on their web site told me to do the wrong thing. I only got it to work after a support call to them.

Wise Or Not So Wise

Now lets talk a but about Wise for Visual Studio .NET. While it has features that the Visual Studio install does not, over all it is flaky and difficult to use (if you are doing any type of custom install). One of the things that makes Wise hard to use is their lack of documentation. While it does come with a reference manual and a help file, both are severely lacking in details and “how to’s” and there literally no samples on how to do the tasks in Wise. It took me awhile to figure out the only way to get to the help file is via a dialog box… there is no way to “browse” the help file if you want to just look around and get familiar with the product. Speaking of samples, Wise does not come with any sample projects or sample scripts to help you get started. It only comes with two tutorials in one of the included PDF’s. So, if you want help on how to write VBScript files or .NET projects to interact with your install, forget it. Their help file also includes many links to the Windows Install SDK help file, which did not work even after I installed the SDK.

Unfortunately, as long as Wise has been around their documentation has not been very good. They do have a knowledgebase up on their web site, but you have to be a registered user to even use it and it is not much better than their help files. I actually found an article that told me to do something the wrong way (which caused a support call to Wise).

Now let’s talk more about why Wise is flaky. Here is an example: Sometimes it takes three or more tries (or the planets align) to add a script from the Wise Script Editor to get it to work. It never seems to work on the first try. I usually add the script… nothing happens when I run the install. Then I add it again and I get a memory error when run from the install. Then I add it again and I get another error that the program cannot be run. Then, if I am lucky the forth try (or more) it will just magically start working! There seems to be no rhyme or reason.

Setting and creating dialog boxes in Wise is very difficult. What makes it so difficult if you want to move the dialog box to a different place in the sequence during the install. Basically, you can’t. One time I just deleted the dialog, added a new one and Wise totally screwed up the dialog sequences some how. I kept getting a “loop” error and I could not figure out why. I just had to start over and create an entirely new install.

Also when adding and removing dialogs, I have found out the hard way that to move from forward and backward through the dialogs it all has to be set up in Windows Install events. You would think that Wise would help you out when adding and removing dialogs and add these events so the dialogs will appear correctly. Well Wise tries (I think) but does a very poor job. You will have to learn all about events (not as easy as you might think) and fix