Hi guys,

I'm developing a VS project template (vsix package) and may be stumbled upon a 
bug in WiX (Votive???). The template includes a DTE IWizard class that 
identifies all projects in the solution that output an MSI package. The part of 
the wizard that determines this is the following bit of code.

    public static String GetOutputFullName(this Project source)
    {
        if (source == null)
        {
            return String.Empty;
        }

        String fullPath = source.Properties.Item("FullPath").Value.ToString();
        String outputPath = 
source.ConfigurationManager.ActiveConfiguration.Properties.Item("OutputPath").Value.ToString();
        String outputFile = 
source.Properties.Item("OutputFileName").Value.ToString();
        return Path.Combine(fullPath, outputPath, outputFile);
    }

I've found that a WiX project that includes a fullstop in the OutputName 
property returns a truncated value for the OutputFileName property. The build 
output is not affected with this issue and the correct msi file name is 
produced. This appears to be just an issue with the DTE project property.

For example:

Neovolve will output Neovolve.msi
Neovolve Switch will output Neovolve Switch.msi
Neovolve.Switch will output Neovolve.msi.

I patched my wizard code to get around this by using the following.

    public static String GetOutputFullName(this Project source)
    {
        if (source == null)
        {
            return String.Empty;
        }

        if (source.Kind == VsProjectKindSolutionFolder)
        {
            return String.Empty;
        }

        if (source.Kind == VsProjectKindMisc)
        {
            return String.Empty;
        }

        String fullPath = source.Properties.Item("FullPath").Value.ToString();
        String outputPath = 
source.ConfigurationManager.ActiveConfiguration.Properties.Item("OutputPath").Value.ToString();
        String outputFile = 
source.Properties.Item("OutputFileName").Value.ToString();

        if (VsProjectKindWix.Equals(source.Kind, 
StringComparison.OrdinalIgnoreCase))
        {
            String outputName = 
source.Properties.Item("OutputName").Value.ToString();

            String strippedOutputFile = 
Path.GetFileNameWithoutExtension(outputFile);

            if (strippedOutputFile.Equals(outputName, 
StringComparison.OrdinalIgnoreCase) == false)
            {
                // This catches an apparent bug in WiX where sometimes the 
OutputFileName property does not accurately reflect the OutputName property
                String extension = Path.GetExtension(outputFile);

                outputFile = outputName + extension;
            }
        }

        return Path.Combine(fullPath, outputPath, outputFile);
    }

Does this look like a WiX bug or am I missing something.

Cheers,

Rory
------------------------------------------------------------------------------
AppSumo Presents a FREE Video for the SourceForge Community by Eric 
Ries, the creator of the Lean Startup Methodology on "Lean Startup 
Secrets Revealed." This video shows you how to validate your ideas, 
optimize your ideas and identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to