Created
August 26, 2015 08:15
-
-
Save wallymathieu/b1694060b65fa3c7153e to your computer and use it in GitHub Desktop.
Howto add links from one projects files into another project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'visual_studio_files' # https://rubygems.org/gems/visual_studio_files | |
desc "regenerate links in project X" | |
task :regen_links do | |
project_y = VisualStudioFiles::CsProj.new(File.open(File.join($dir,'ProjectY','ProjectY.csproj'), "r").read) | |
project_y_files = v.files.select do |file| | |
file.type=='Compile' && !file.file.end_with?('AssemblyInfo.cs') | |
end | |
project_x = VisualStudioFiles::CsProj.new(File.open(File.join($dir,'ProjectX','ProjectX.csproj'), "r").read) | |
project_x.clear_links | |
project_y_files.each do |file| | |
hash = file.to_hash | |
hash[:file] = "..\\ProjectX\\#{file.file}" | |
hash[:link] = "ProjectX\\#{file.file}" | |
project_x.add(hash) | |
end | |
File.open(File.join($dir,'ProjectX','ProjectX.csproj'), "w") do |f| | |
project_x.write f | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment