Skip to content

Instantly share code, notes, and snippets.

@geoffappleford
Created July 26, 2013 10:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save geoffappleford/6087882 to your computer and use it in GitHub Desktop.
Save geoffappleford/6087882 to your computer and use it in GitHub Desktop.
Fix for RazorGenerator custom tool not running in VS 2012
void Main()
{
var extFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), @"AppData\Local\Microsoft\VisualStudio\11.0\Extensions");
var source = Path.GetDirectoryName(Directory.GetFiles(extFolder, "*.dll", SearchOption.AllDirectories).FirstOrDefault(f => f.EndsWith("RazorGenerator.dll")));
var assemblyBaseFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), @"AppData\Local\assembly\dl3");
var assemblyFolders = Directory.GetFiles(assemblyBaseFolder, "*.dll", SearchOption.AllDirectories).Where(f => f.Contains("RazorGenerator"))
.Select(c => Path.GetDirectoryName(c));
foreach (var target in assemblyFolders){
Copy(Path.Combine(source, @"RazorGenerator.dll"), Path.Combine(target, @"RazorGenerator.dll"));
Copy(Path.Combine(source, @"RazorGenerator.Core.dll"), Path.Combine(target, @"RazorGenerator.Core.dll"));
Copy(Path.Combine(source, @"v1\RazorGenerator.Core.v1.dll"), Path.Combine(target, @"RazorGenerator.Core.v1.dll"));
Copy(Path.Combine(source, @"v2\RazorGenerator.Core.v2.dll"), Path.Combine(target, @"RazorGenerator.Core.v2.dll"));
};
}
// Define other methods and classes here
private void Copy(string source, string target){
if (!File.Exists(target)){
File.Copy(source, target);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment