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

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

@ -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 @@
<Compile Include="Project\GetWixFileProjectItemsTestFixture.cs" /> <Compile Include="Project\GetWixFileProjectItemsTestFixture.cs" />
<Compile Include="Project\WixBuilderCannotBuildNonWixProjectTestFixture.cs" /> <Compile Include="Project\WixBuilderCannotBuildNonWixProjectTestFixture.cs" />
<Compile Include="Gui\WixProjectWithUnexpandedLibraryItemsTestFixture.cs" /> <Compile Include="Gui\WixProjectWithUnexpandedLibraryItemsTestFixture.cs" />
<Compile Include="Project\WixProjectTests.cs" />
<Compile Include="Utils\DerivedAddElementCommand.cs" /> <Compile Include="Utils\DerivedAddElementCommand.cs" />
<Compile Include="Utils\MockCaret.cs" /> <Compile Include="Utils\MockCaret.cs" />
<Compile Include="Utils\MockFormsDesignerView.cs" /> <Compile Include="Utils\MockFormsDesignerView.cs" />

Loading…
Cancel
Save