<Target Name="ProtobufCompile"
Inputs="@(ProtocCompile)"
Outputs="$(IntermediateOutputPath)$([System.Text.RegularExpressions.Regex]::Replace( %(ProtocCompile.RelativeDir) , ..[/\] , ))%(ProtocCompile.Filename).cs">
<PropertyGroup>
<protooutdir>$(IntermediateOutputPath)$([System.Text.RegularExpressions.Regex]::Replace( %(ProtocCompile.RelativeDir) , ..[/\] , ))</protooutdir>
</PropertyGroup>
<Message Text="%(ProtocCompile.Filename)%(ProtocCompile.Extension)" Importance="high" />
<MakeDir Directories="$(protooutdir)" />
<Exec Command="$(ProtobufCompiler) --protoc_dir=${PROTOBUF_PROTOC_EXECUTABLE}/.. --proto_path=%(ProtocCompile.RootDir)%(ProtocCompile.Directory) -output_directory=$(protooutdir) %(ProtocCompile.FullPath)" />
</Target>
<!-- set Intputs and Outputs -->
<Target Name="ProtobufCSharpCompile"
DependsOnTargets="ProtobufCompile">
<CreateItem Include="$(IntermediateOutputPath)$([System.Text.RegularExpressions.Regex]::Replace( %(ProtocCompile.RelativeDir) , ..[/\] , ))%(ProtocCompile.Filename).cs">
<Output TaskParameter="Include" ItemName="Compile"/>
</CreateItem>
</Target>
<Target Name="ProtobufClean"
BeforeTargets="Clean">
<Delete Files="$(IntermediateOutputPath)$([System.Text.RegularExpressions.Regex]::Replace( %(ProtocCompile.RelativeDir) , ..[/\] , ))%(ProtocCompile.Filename).cs" />
</Target>
这是一份目标文件。 如何简化这一法典? • 如何减少下文描述的重复?
$(IntermediateOutputPath)$([System.Text.RegularExpressions.Regex]::Replace( %(ProtocCompile.RelativeDir) , ..[/\] , ))