MSI build is failing with failed to add file - Even path is available
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*.*")
)
));
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.
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
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.
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
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.
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.
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.