wixsharp icon indicating copy to clipboard operation
wixsharp copied to clipboard

MSI build is failing with failed to add file - Even path is available

Open dorlep opened this issue 1 year ago • 7 comments

I am facing below error: the provided path is valid and file is available there My code is as below : Feature poFeature = new Feature("QO", "QO", "INSTALLDIR");

var project = new ManagedProject(Constants.PRODUCTNAME, new Dir(Constants.DEFAULTINSTALLDIR, new InstallDir("Pr_Orchestrator", new Files(qoFeature, @"C:\Builds\37\s\CLIENTWEBUI*."), new Files(qoFeature, @"C:\Builds\37\s\PData.Database*."), new Files(qoFeature, @"C:\Builds\37\s\PData.ApiGateway*."), new Files(qoFeature, @"C:\Builds\37\s\PRequest.WebApi*."), new Files(qoFeature, @"C:\Builds\37\s\P.WebAPI*.*") )
));

dorlep avatar Jul 17 '24 14:07 dorlep

morning, it looks like you want to add files as wildcard from path. To do so, you have to use wildcard by addiing files. There is sample in examples of @oleg-shilo. Something like

 new Files(path + @"\*.*",
                              f => !f.EndsWith(".obj") &&
                                   !f.EndsWith(".pdb")
                                   && !f.EndsWith(".tdb")
                                   && !f.EndsWith(".ipm")
                                   && !f.EndsWith(".fma")
                                   && !f.EndsWith(".pdf")
                                   && !f.EndsWith(".png")
                                   && !f.EndsWith(".docx"))
                                   {
                                     AttributesDefinition = "ReadOnly=no" 
                                   },

where path is given by string variable before.

Torchok19081986 avatar Jul 18 '24 07:07 Torchok19081986

Hi Torchok,

Thank you for reply.

But with your solution we are excluding files, but the requirement is I need those files as well. Please advice.

Thanks in advance

dorlep avatar Jul 19 '24 14:07 dorlep

The suggestion @Torchok19081986 gave you achieves a more granular control of what to include in your msi. But it does not solve the problem.

I just repeated your scenario and could not detect the problem:

static class Script
{
    static public void Main()
    {
        Feature poFeature = new Feature("PO", "PO", "INSTALLDIR");

        var project = new ManagedProject("My Product",
            new Dir(@"%ProgramFiles%\My Company",
                new InstallDir("My Product",
                    new Files(poFeature, @"C:\Builds\a\*.*"),
                    new Files(poFeature, @"C:\Builds\b\*.*"))));

        project.GUID = new Guid("6f330b47-2577-43ad-9095-1861ba25889b");

        Compiler.EmitRelativePaths = true;

        project.BuildMsi();
    }
}

So please prepare the test case, something simple as a hello-world project, and I can have a look at it.

oleg-shilo avatar Jul 20 '24 08:07 oleg-shilo

Hi oleg-shilo,

What I observer is path and file name is big, like below is the example of file name

  • TEST.Risk.ExampleFileRiskSuite.POTestData.EM.API.Core.dll.config

this big name files are failing. please advise.

Thanks in advance

dorlep avatar Jul 20 '24 15:07 dorlep

No that is not it. I repeated the test with your file name and it's all OK.

Anyway, since it looks like giving me the example is not an option for you, you can analyze the produced wxs file and see which source is invalid. You can also clean your C:\Builds\37\s\ folder and start adding the files there one by one until they break the build.

oleg-shilo avatar Jul 21 '24 03:07 oleg-shilo

morning , i had same issue long time ago. If filename is too big and in wxs comes addtionally guid for file , somehow i got error. in one of projects i use compiler.custommask somehow so, to control output filename to short filename. It works after that.

Torchok19081986 avatar Jul 22 '24 06:07 Torchok19081986

It, a valid suggestion @Torchok19081986. @dorlep what are your file names (the full path)? You can see now why I am asking for a sample.

oleg-shilo avatar Jul 22 '24 13:07 oleg-shilo