Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attributes inheritance in Files and DirFiles #23

Closed
manytwo opened this issue Feb 20, 2017 · 3 comments
Closed

Attributes inheritance in Files and DirFiles #23

manytwo opened this issue Feb 20, 2017 · 3 comments

Comments

@manytwo
Copy link

manytwo commented Feb 20, 2017

Is there a "trick" to use custom attribues with Files and DirFiles ?

I m trying to do something like this (set DiskId to all files):

new DirFiles(feature1, @"Files\Feature1\Docs\*.*")
{
    AttributesDefinition = "DiskId=1"
},

For Files, as there is two wix Elements (dir and file), we should use same syntax used for file and component:

new Files(feature1, @"Files\Feature1\Docs\*")
{
     AttributesDefinition = "File:DiskId=1;Dir:AnotherAttribute=Value"
},

Another question, related to my DiskId use:
WixSharp support only one Media element?

This code doesn't work, only last cab is on wxs output.
I suppose only one is used , because project have a property (not a collection) project.Media.

new Project("Project1"
   new Media() { Id = 1, Cabinet = "media1.cab" },
   new Media() { Id = 2, Cabinet = "media2.cab" },
)

I don't understand this limitation when I see what WixSharp is able to do! It is really extensible so I rewrite wxs after generation, but it should be natively supported. (Or there is a good reason I did'nt see ;) )

@oleg-shilo oleg-shilo added the bug label Feb 21, 2017
@oleg-shilo
Copy link
Owner

The responsibility of the wild card based entities are aggregating files but not initializing them. That is why the current implementation does not allow assignment of the File properties. Though I do like your idea. Can you please log it as a dedicated enhancement request so it is not lost.

Until it's implemented please use the following technique:

project.ResolveWildCards();

project.AllFiles
       .Where(f => f.Feature.Name == "Feature1")
       .ForEach(f => f.AttributesDefinition = "File:DiskId=1;Dir:AnotherAttribute=Value");

project.AllFiles
       .Where(f => f.Feature.Name == "Feature2")
       .ForEach(f => f.AttributesDefinition = "File:DiskId=2;Dir:AnotherAttribute=Value");

As for Media element it is currently encoded as a single element per product. This is a clear limitation and so I labeled your post as a bug.

Though I would rather encourage you to use MediaTemplate instead of Media as it seems to be a more attractive option:

project.WixSourceGenerated += doc =>
{
    doc.Root.Select("Product")
            .AddElement("MediaTemplate", "CabinetTemplate=cab{0}.cab, CompressionLevel=mszip");
};

@manytwo
Copy link
Author

manytwo commented Feb 23, 2017

Created issue for enhancement as required.
Please say me if it is too much detailed if you prefer only a single "question" for enhancement request, if I need to do an other one.

@manytwo manytwo closed this as completed Feb 23, 2017
@oleg-shilo
Copy link
Owner

Don't worry. I have already processed your issue report and the fix was done even yesterday. It's all good. Txs

oleg-shilo added a commit that referenced this issue Feb 28, 2017
* Issue #27: Fixing AppSearch.GetProducts() crash
* Added support for `MediaTemplate` element.
* Added tunneling of Files and DirFiles attributes to the aggregated File items
* Issue #23: Attributes inheritance in Files and DirFiles
* Added Compiler.GetMappedWixConstants() for exploring WiX constants mapping
* Adding %CommonAppDataFolder% to Dir.cs description
* Issue #20: File.Attributes (on parent Component) after setting File.NeverOverwrite will not work
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants