Browse Source

Set the KeyPath to true when adding a file with its own parent component in the WiX setup files editor.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@3223 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Matt Ward 17 years ago
parent
commit
3dfb4d627d
  1. 8
      src/AddIns/BackendBindings/WixBinding/Project/Src/WixFileElement.cs
  2. 9
      src/AddIns/BackendBindings/WixBinding/Project/Src/WixPackageFilesEditor.cs
  3. 6
      src/AddIns/BackendBindings/WixBinding/Test/DirectoryImport/AddSubDirectoryTestFixture.cs
  4. 6
      src/AddIns/BackendBindings/WixBinding/Test/PackageFiles/AddFilesTestFixture.cs

8
src/AddIns/BackendBindings/WixBinding/Project/Src/WixFileElement.cs

@ -74,6 +74,14 @@ namespace ICSharpCode.WixBinding @@ -74,6 +74,14 @@ namespace ICSharpCode.WixBinding
set { SetAttribute("Id", value); }
}
/// <summary>
/// Gets whether the file is the KeyPath for its parent component.
/// </summary>
public string KeyPath {
get { return GetAttribute("KeyPath"); }
set { SetAttribute("KeyPath", value); }
}
/// <summary>
/// Gets the name of the file without any path information.
/// This is the name that will be used when installing the file.

9
src/AddIns/BackendBindings/WixBinding/Project/Src/WixPackageFilesEditor.cs

@ -253,7 +253,7 @@ namespace ICSharpCode.WixBinding @@ -253,7 +253,7 @@ namespace ICSharpCode.WixBinding
WixComponentElement componentElement = view.SelectedElement as WixComponentElement;
WixDirectoryElement directoryElement = view.SelectedElement as WixDirectoryElement;
if (componentElement != null) {
WixFileElement fileElement = AddFile(componentElement, fileName);
WixFileElement fileElement = AddFile(componentElement, fileName, false);
view.AddElement(fileElement);
view.IsDirty = true;
} else if (directoryElement != null) {
@ -266,12 +266,15 @@ namespace ICSharpCode.WixBinding @@ -266,12 +266,15 @@ namespace ICSharpCode.WixBinding
/// <summary>
/// Adds a file to the specified component element.
/// </summary>
WixFileElement AddFile(WixComponentElement componentElement, string fileName)
WixFileElement AddFile(WixComponentElement componentElement, string fileName, bool keyPath)
{
WixFileElement fileElement = componentElement.AddFile(fileName);
if (!componentElement.HasDiskId) {
componentElement.DiskId = "1";
}
if (keyPath) {
fileElement.KeyPath = "yes";
}
return fileElement;
}
@ -433,7 +436,7 @@ namespace ICSharpCode.WixBinding @@ -433,7 +436,7 @@ namespace ICSharpCode.WixBinding
{
string id = WixComponentElement.GenerateIdFromFileName(document, fileName);
WixComponentElement component = AddComponent(directoryElement, id);
AddFile(component, fileName);
AddFile(component, fileName, true);
return component;
}

6
src/AddIns/BackendBindings/WixBinding/Test/DirectoryImport/AddSubDirectoryTestFixture.cs

@ -85,6 +85,12 @@ namespace WixBinding.Tests.DirectoryImport @@ -85,6 +85,12 @@ namespace WixBinding.Tests.DirectoryImport
Assert.IsNotNull(readmeFileElement);
}
[Test]
public void ReadmeFileElementIsKeyPath()
{
Assert.AreEqual("yes", readmeFileElement.GetAttribute("KeyPath"));
}
/// <summary>
/// Gets the MyApp directory files.
/// </summary>

6
src/AddIns/BackendBindings/WixBinding/Test/PackageFiles/AddFilesTestFixture.cs

@ -73,6 +73,12 @@ namespace WixBinding.Tests.PackageFiles @@ -73,6 +73,12 @@ namespace WixBinding.Tests.PackageFiles
Assert.AreEqual(@"docs\readme.rtf", readmeFileElement.GetAttribute("Source"));
}
[Test]
public void ReadmeFileElementKeyPathNotSet()
{
Assert.IsFalse(readmeFileElement.HasAttribute("KeyPath"));
}
[Test]
public void ExeFileLongNameAttributeDoesNotExist()
{

Loading…
Cancel
Save