Dec 7 2007

Windows Installer Argument Passing

Category: Windows SetupBil@l @ 20:06

In a Windows Installer setup project I was developing, I had the need to run a script on the Install action of the Windows Installer. There could be several ways of doing so either using:

  1. vbs
  2. Windows Installer Class
  3. exe application

I decided to go for a Console application. However, I needed to perform some logic inside the console application based on parameters from the Windows Installer. So how can I pass parameters from the Windows Installer to the custom action handlers?

In the figure below, you can see that I am viewing the Windows Installer files in a Custom Action View:

 

I have added an EXE application to run at the Install action of the Windows Installer. If you select the Properties window of the EXE you notice the Arguments property. Here you can pass as many arguments as you want by surrounding the argument with a double quotes.

In the above example, I am passing the

  1. TARGETDIR: This property gets the path of the folder where the Windows Installer shall use to install the accompanying files on the user's machine.
  2. SOURCEDIR: This property gets the path where the MSI is being executed and running on the user's machine.

You could pass any property you want. Here is a link to a very wonderful reference for all the properties that you could pass in a Windows Instalelr: Windows Installer Property Reference

Now, inside the AddToExplorer, you could access the above two arguments as follows:

static void Main(string[] args)
{
    if ((string.IsNullOrEmpty(args[0])) || (string.IsNullOrEmpty(args[1])))
        throw new ArgumentException("Input parameters are invalid");

    string targetDir = args[0];
    string sourceDir = args[1];

 

Hope this post is useful for you!

Regards

Tags:

Nov 29 2007

Microsoft Workflow Foundation Webcasts

Category:Bil@l @ 06:54

I have been browsing online to locate some Web casts on WF and found this blog post by Paul Andrew, which lists several Web cast links:

http://blogs.msdn.com/pandrew/articles/460630.aspx

 

I am sure you will appreciate that blog post when you start looking for resources on WF!!

 

HTH,
Regards

Tags:

Nov 28 2007

let clause in C#

Category:Bil@l @ 11:16

I have discovered a new reserved C# word called let. "let" can be used inside your LINQ queries to store the result of a sub-expression that can be used in subsequent sections of the query.

For example, here is a sample from MSDN:

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

namespace TestingApp
{
    class Test
    {
        public static void Main()
        {
            string[] strings =
        {
            "A penny saved is a penny earned.",
            "The early bird catches the worm.",
            "The pen is mightier than the sword."
        };

            // Split the sentence into an array of words
            // and select those whose first letter is a vowel.
            var earlyBirdQuery =
                from sentence in strings
                let words = sentence.Split(' ')
                from word in words
                let w = word.ToLower()
                where w[0] == 'a' || w[0] == 'e'
                    || w[0] == 'i' || w[0] == 'o'
                    || w[0] == 'u'
                select word;

            // Execute the query.
            foreach (var v in earlyBirdQuery)
            {
                Console.WriteLine("\"{0}\" starts with a vowel", v);
            }

            // Keep the console window open in debug mode.
            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();
        }
    }

}

You can notice the two bold lines above. In the first line, we are setting the variable words to be a collection of all the words inside a single sentence, hence the type of words is now IEnumerable<string>.

In the second statement, we are querying the words variable (we can do this since words is IEnumerable<string> == Queryable Type) and letting the variable w hold the lowercase for each word in the words.

You can see how useful it is in some cases to cache an expression inside a let clause variable and then reference it later on in the query.

 

HTH,
Regards

Tags:

Nov 27 2007

System.Data.DataSetExtensions Exception in VS 2008 RTM

Category:Bil@l @ 21:15

I got the exception shown below when I opened an application that was developed under VS 2008 beta 2:

ASP.NET runtime error: Could not load file or assembly 'System.Data.DataSetExtensions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified

 

What happened is that, there is no more an assembly System.Data.DataSetExtensions with version number 2.0. There is a new version for the same assembly name under 3.5.0.0.

To resolve the problem, simply right-click on the web application, properties, then remove the reference to the 2.0.0.0 assembly.

Then, right-click on the web application solution, Add Reference, locate the System.Data.DataSetExtensions and add a reference to it. This shall solve your problem!

 

HTH,
Regards


CCIE routing and switching written exam 350-001 by Cisco buffs up a candidate’s networking skills. You can develop skills to pass VM Ware certified professional VCP-310 exam online. Exam guides to pass CCNA 640-802 tests are easily available online. Microsoft MCSE 2003 70-290 are written and complied authentic networking experts.

Tags:

Nov 27 2007

Client Application Services

Category:Bil@l @ 19:18

I have noticed today something new in the VS 2008 (Orcas) and .NET 3.5 which is Client Application Services. As I understood, since in ASP.NET 2.0 you have Application Services which includes Membership, Role, and Profile services, they can be only used in ASP.NET world. But what about Windows-Based applications? How can they access those services so that both a Web application and a Windows application can share the same data?

The solution by creating Client Application Services which help you use those services.

I will be posting several posts on this topic very soon and show you how easy it is to use the above mentioned services in your Windows-Based applications!

 

HTH,
Regards

Tags:

Nov 27 2007

Silverlight 1.1 Tools for Visual Studio 2008 available for download

Category:Bil@l @ 06:47

There is a new updated version of the Silverlight 1.1 Tools for Visual Studio 2008 that works with the latest release of the Visual Studio 2008.

You can read more about it here: http://blogs.msdn.com/webdevtools/archive/2007/11/27/silverlight-1-1-tools-for-visual-studio-2008-available-for-download.aspx

 

Hope this helps,
Regards

 


Sony car cd mp3 players are remarkable all-in-one in-car communication devices. New models of laptop computers by Sony are also superb in terms of features and durability. Sony computers Vaio PCV-RS220 has good internet explorer which is excellent for photoshop, and acrobat games for children run well. Its good to read reviews before buying a desktop computer.

Tags:

Nov 24 2007

Unit Testing in Visual Studio 2008 Professional

Category:Bil@l @ 20:20

I have been browsing through the Visual Studio 2008 Training Kit and noticed on one of the slides that Unit Testing is now available in VS 2008 Professional.

I believe this is great and forces people to use unit testing even if companies or individuals cannot handle buying the VSTS, which in my opinion is very expensive for companies, how will it be for individuals?

 

Hope this hint helps,
Regards

Tags:

Nov 22 2007

Lebanese Independence Day

Category:Bil@l @ 15:06

Today is the Lebanese 64’Th Independence Day which is on the 22nd of November of every year.