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 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 at 10:02

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")
                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.

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.