-1

I'm migrating Sitecore 9.1.0 to Azure. During the process of build on Azure DevOps, I have a gulp tasks, which builds the solution and transforms the configuration files.

On certain configuration files, I get this error :

d:\a\1\s\source\back-end\applytransform.targets(19,5): error : Could not open Source file: Could not find file 'd:\a\1\s\source\back-end\output\website\App_Config\Include\Coveo\Coveo.CloudPlatformClient.Custom.config'.
                     Transformation failed (TaskId:6)
                   Done executing task "TransformXml" -- FAILED. (TaskId:6)
22:43:39.305     1>Done building target "ApplyTransform" in project "applytransform.targets" -- FAILED.: (TargetId:2)
22:43:39.305     1>Done Building Project "d:\a\1\s\source\back-end\applytransform.targets" (ApplyTransform target(s)) -- FAILED.

Could you tell me why ? I have no more details on these errors...

  • Well it's not a transform error as such. The file just isn't there. Are you sure everything you need, is part of your repository? – Mark Cassidy May 21 '19 at 9:52
  • Yes, the file is there, because I've launched the build on a local computer and the file is properly copied to the mentioned path... – Thomas GRIESMAR May 21 '19 at 10:02
  • Just a question, why are you using a build process to transform anything under App_Config/Include with Sitecore 9.x? With the roles system now, you can just write patch files and apply to the right roles. The only file you should need to transform these days really is the web.config. Maybe files directly under App_Config if you -really- need to make changes. – Ken McAndrew Feb 16 at 15:17
0

Finally, I resolved my issue by correcting the Source file parameter in the TransformXML task, in my gulp file :

  var fileToTransform = exp.exec(file.path)[1];
        var fileSourcePath = file.path.replace("\\" + fileToTransform + ".transform" + role, '');

        gutil.log("Applying configuration transform: " + file.path);
        gutil.log("File to transform: " + fileToTransform);
        gutil.log("Destination path: " + configDestination);
        gutil.log("Source path: " + configSource);
        gutil.log("File Source Path: " + fileSourcePath);

And further in the document :

            return gulp.src("./applytransform.targets")
            .pipe(msbuild({
                targets: ["ApplyTransform"],
                configuration: config.buildConfiguration,
                logCommand: false,
                verbosity: "minimal",
                stdout: true,
                errorOnFail: false,
                maxcpucount: 0,
                toolsVersion: config.buildToolsVersion,
                properties: {
                    Platform: config.buildPlatform,
                    SourceConfigToTransform: fileSourcePath,
                    DestinationConfigToTransform: configDestination,
                    TransformFile: file.path,
                    FileToTransform: fileToTransform,
                    ConfigDirectory: path.dirname(fileToTransform)
                }
            }));

Be careful when you go to MSBuild 15.0, the source path has to change.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.