Browse Source

Fix ${TargetPath} evaluating to wrong file extension for WiX projects.

pull/21/merge
Matt Ward 14 years ago
parent
commit
e3d160c6da
  1. 22
      src/AddIns/BackendBindings/WixBinding/Project/Src/Project/WixProject.cs
  2. 37
      src/AddIns/BackendBindings/WixBinding/Test/Project/WixProjectTests.cs
  3. 1
      src/AddIns/BackendBindings/WixBinding/Test/WixBinding.Tests.csproj

22
src/AddIns/BackendBindings/WixBinding/Project/Src/Project/WixProject.cs

@ -5,6 +5,7 @@ using System; @@ -5,6 +5,7 @@ using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using ICSharpCode.SharpDevelop.Dom;
@ -60,7 +61,7 @@ namespace ICSharpCode.WixBinding @@ -60,7 +61,7 @@ namespace ICSharpCode.WixBinding
base.Start(false); // debugging not supported
}
public override System.Diagnostics.ProcessStartInfo CreateStartInfo()
public override ProcessStartInfo CreateStartInfo()
{
switch (StartAction) {
case StartAction.Project:
@ -109,12 +110,21 @@ namespace ICSharpCode.WixBinding @@ -109,12 +110,21 @@ namespace ICSharpCode.WixBinding
/// </summary>
public string GetInstallerFullPath()
{
string outputPath = GetEvaluatedProperty("OutputPath") ?? String.Empty;
string outputType = GetEvaluatedProperty("OutputType") ?? String.Empty;
string outputName = GetEvaluatedProperty("OutputName") ?? String.Empty;
string outputPath = GetEvaluatedPropertyOrEmptyString("OutputPath");
string outputType = GetEvaluatedPropertyOrEmptyString("OutputType");
string outputName = GetEvaluatedPropertyOrEmptyString("OutputName");
string fileName = String.Concat(outputName, GetInstallerExtension(outputType));
return Path.Combine(Directory, outputPath, fileName);
}
string GetEvaluatedPropertyOrEmptyString(string propertyName)
{
return GetEvaluatedProperty(propertyName) ?? String.Empty;
}
public override string OutputAssemblyFullPath {
get { return GetInstallerFullPath(); }
}
/// <summary>
/// Adds a set of Wix libraries (.wixlib) to the project.
@ -177,7 +187,7 @@ namespace ICSharpCode.WixBinding @@ -177,7 +187,7 @@ namespace ICSharpCode.WixBinding
/// </remarks>
public string GetPreprocessorVariableValue(string name)
{
string constants = GetEvaluatedProperty("DefineConstants") ?? String.Empty;
string constants = GetEvaluatedProperty("DefineConstants");
NameValuePairCollection nameValuePairs = new NameValuePairCollection(constants);
return WixPropertyParser.Parse(nameValuePairs.GetValue(name), this);
}
@ -214,7 +224,7 @@ namespace ICSharpCode.WixBinding @@ -214,7 +224,7 @@ namespace ICSharpCode.WixBinding
/// AssemblyName must be implemented correctly - used when renaming projects.
/// </summary>
public override string AssemblyName {
get { return GetEvaluatedProperty("OutputName") ?? Name; }
get { return GetEvaluatedProperty("OutputName"); }
set { SetProperty("OutputName", value); }
}

37
src/AddIns/BackendBindings/WixBinding/Test/Project/WixProjectTests.cs

@ -0,0 +1,37 @@ @@ -0,0 +1,37 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using ICSharpCode.WixBinding;
using NUnit.Framework;
using WixBinding.Tests.Utils;
namespace WixBinding.Tests.Project
{
[TestFixture]
public class WixProjectTests
{
WixProject project;
void CreateProject()
{
project = WixBindingTestsHelper.CreateEmptyWixProject();
}
[Test]
public void OutputAssemblyFullPath_ProjectOutputTypeIsPackage_FileExtensionIsMsi()
{
CreateProject();
project.FileName = @"d:\projects\MySetup\MySetup.wixproj";
project.AssemblyName = "MySetup";
project.SetProperty("OutputPath", @"bin\debug");
project.SetProperty("OutputType", "Package");
string assemblyFullPath = project.OutputAssemblyFullPath;
string expectedAssemblyFullPath = @"d:\projects\MySetup\bin\debug\MySetup.msi";
Assert.AreEqual(expectedAssemblyFullPath, assemblyFullPath);
}
}
}

1
src/AddIns/BackendBindings/WixBinding/Test/WixBinding.Tests.csproj

@ -107,6 +107,7 @@ @@ -107,6 +107,7 @@
<Compile Include="Project\GetWixFileProjectItemsTestFixture.cs" />
<Compile Include="Project\WixBuilderCannotBuildNonWixProjectTestFixture.cs" />
<Compile Include="Gui\WixProjectWithUnexpandedLibraryItemsTestFixture.cs" />
<Compile Include="Project\WixProjectTests.cs" />
<Compile Include="Utils\DerivedAddElementCommand.cs" />
<Compile Include="Utils\MockCaret.cs" />
<Compile Include="Utils\MockFormsDesignerView.cs" />

Loading…
Cancel
Save