我有一些项目的解决方案。我想分别更新每个项目中的AssemblyInfo.cs文件。文件中的大多数信息将是相同的,但是可能有一两件事我想有所不同。我还没办法找到一种用Albacore assemblyinfo任务完成此任务的方法。

我追求的语法类型是

# I know this won't work but I would like to be able to call the assemblyinfo
# task a number of times and each time pass in at least the input_filename
task :update_assemblyinfo_files do
  assemblyinfo '/src/myproj1/properties/assemblyinfo.cs'
  assemblyinfo '/src/myproj2/properties/assemblyinfo.cs'
end

assemblyinfo :assemblyinfo do |asm|
  asm.version = version
  asm.input_file = <an-input-parameter>
end

最佳答案

一个想法可以是将常用的assemblyinfo参数存储在rake文件中(或外部文件,例如使用yaml)中,该方法可以将其读取到rake中,然后按以下方式配置任务:

task :update_assemblyinfo_files => [:update_a, :update_b, :update_c]

然后在每个更新任务中
assemblyinfo :update_a do |asm|
  common_info = get_common_assemblyinfo()
  asm.version = common_info[:version]
  asm.company_name = common_info[:company_name]
  asm.product_name = common_info[:product_name]
  asm.output_file = "your_file_path"
end

def get_common_assemblyinfo()
  #read your yaml here and return it
end

关于.net - 如何使用Albacore assemblyinfo任务分别更新多个AssemblyInfo.cs文件?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/8041392/

10-12 20:31