如何让 MSBuild 任务使用来自外部 xml 参数文件的参数?
示例:为我的 MSBuild 任务使用来自外部 xml 文件的“MyConnectionStringParameter”。
MSBuild 文件:
<?xml version="1.0"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Migrate">
<UsingTask TaskName="FluentMigrator.MSBuild.Migrate"
AssemblyFile="../bin/FluentMigrator.MSBuild.dll"/>
<PropertyGroup>
<TargetPath>../bin/Target.dll</TargetPath>
</PropertyGroup>
<Target Name="Migrate" >
<Message Text="Starting FluentMigrator Migration"/>
<Migrate Database="sqlserver2008"
Connection="$(MyConnectionStringParameter)"
Target="$(TargetPath)"
Verbose="True"
Output="True"
OutputFilename="generated.sql">
</Migrate>
</Target>
</Project>
参数文件:
<?xml version="1.0" encoding="utf-8"?>
<parameters>
<setParameter name="MyConnectionStringParameter" value="ParameterValue" />
</parameters>