本文介绍了MSBuild覆盖输出文件名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要能够重写输出程序集的名称.

I need to be able to overrire the name of output assemblies.

有一个包含前缀appid的文件.我需要读取文件以获取此前缀,然后将其用作程序集名称.即,程序集名称engine.dll和appid包含slot_113.最终输出应该是engine_slot113.dll.

There is a file that contains the prefix, appid. I need to read the file to get this prefix and then to use it for assembly name. I.e., assembly name engine.dll and appid contains slot_113. Final output should be engine_slot113.dll.

我正在考虑创建一个单独的.targets文件,该文件可以包含到任何需要该行为的.csproj文件中.

I'm thinking about to create a separate .targets file, that I'm able to include to any .csproj file that requires that behaviour.

我发现一个任务ReadFileLines来读取包含appid的文件,但是我不确定如何覆盖输出名称.

I found a task ReadFileLines to read file contains appid, but I'm not sure how to override output name.

推荐答案

我不认为有一种方法可以覆盖它,但是在后期构建操作中,重命名应该是非常可能的.使用PostBuildEvent.

I don't think there is a way to override it, but in a post build operation renaming it should be very possible. Use the PostBuildEvent.

这篇关于MSBuild覆盖输出文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-26 13:45
查看更多