我知道您可以使用web.config transformations as part of the build for app.config files,但在我的情况下,我尝试执行此操作以执行针对多个环境部署到内部部署服务器的小型计划任务。
我不需要创建多个构建配置,因为唯一的变化是app.config,所以我尝试使用Magic Chunks扩展,但由于我想要的更改的大小要做,我必须使用json文件(而不是使用内联json)。
当我查看发布日志时,Magic Chunks步骤失败了:
2018-01-10T17:33:27.6366230Z ##[section]Starting: Config transform - \\tfs-build\Tasks\DevAzureDeliveryDaemonTest\AzureDispatchers.xml 2018-01-10T17:33:27.6366230Z ============================================================================== 2018-01-10T17:33:27.6366230Z Task : Config transformation 2018-01-10T17:33:27.6366230Z Description : Transform config file with Magic Chunks 2018-01-10T17:33:27.6366230Z Version : 2.0.3 2018-01-10T17:33:27.6366230Z Author : Sergey Zwezdin 2018-01-10T17:33:27.6366230Z Help : [More Information](https://github.com/sergeyzwezdin/magic-chunks) 2018-01-10T17:33:27.6366230Z ============================================================================== 2018-01-10T17:33:27.6522335Z Preparing task execution handler. 2018-01-10T17:33:27.8710415Z Executing the powershell script: C:\agent\_work\_tasks\MagicChunks_985284e0-a7d2-4e4d-802c-0a516bffaadf\2.0.3\transform.ps1 2018-01-10T17:33:28.4335027Z ##[error]System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information. 2018-01-10T17:33:28.4335027Z at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module) 2018-01-10T17:33:28.4335027Z at System.Reflection.Assembly.GetTypes() 2018-01-10T17:33:28.4335027Z at Microsoft.PowerShell.Commands.AddTypeCommand.LoadAssemblyFromPathOrName(List`1 generatedTypes) 2018-01-10T17:33:28.4335027Z at Microsoft.PowerShell.Commands.AddTypeCommand.EndProcessing() 2018-01-10T17:33:28.4335027Z at System.Management.Automation.CommandProcessorBase.Complete() 2018-01-10T17:33:28.4960072Z Transformation found: dispatcher[@Name='oldvalue']/@Name: newvalue
(在这里可以找到json文件中定义的其他转换,但为了简洁起见,需要进行编辑)
2018-01-10T17:33:28.4960072Z 2018-01-10T17:33:28.4960072Z 2018-01-10T17:33:28.5741199Z ##[error]System.Management.Automation.MethodInvocationException: Exception calling "Transform" with "4" argument(s): "Could not load file or assembly 'System.IO.FileSystem, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified." ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.IO.FileSystem, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. 2018-01-10T17:33:28.5741199Z at MagicChunks.TransformTask.Transform(String type, String sourcePath, String targetPath, TransformationCollection transformation) 2018-01-10T17:33:28.5741199Z at CallSite.Target(Closure , CallSite , Type , Object , Object , Object , Object ) 2018-01-10T17:33:28.5741199Z --- End of inner exception stack trace --- 2018-01-10T17:33:28.5741199Z at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception) 2018-01-10T17:33:28.5741199Z at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame) 2018-01-10T17:33:28.5741199Z at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) 2018-01-10T17:33:28.5741199Z at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) 2018-01-10T17:33:28.5741199Z ##[error]PowerShell script completed with 2 errors. 2018-01-10T17:33:28.5897571Z ##[section]Finishing: Config transform - \\tfs-build\Tasks\DevAzureDeliveryDaemonTest\AzureDispatchers.xml
以前是否有人见过这个,知道如何解决(或知道更好的方法来实现这一目标)?
答案 0 :(得分:0)
这似乎是an issue with version 2.x of the Magic Chunks Task。在此问题得到解决之前,更改版本以使用任务版本1.x可以完成