public void Execute(IResponseWriter writer, string[] arguments) { if (arguments.Length != 2) { writer.Write("error|The handler needs the full path to the reference. " + "Usage: dereference {assembly/project} {project to remove reference from}"); return; } var fullpath = getFile(arguments[0]); IFile file; if (new VSProjectFile().SupportsExtension(fullpath)) file = new VSProjectFile().New(fullpath); else file = new AssemblyFile().New(fullpath); var projectFile = getFile(arguments[1]); if (!File.Exists(projectFile)) { writer.Write("error|The project to remove this reference for does not exist. " + "Usage: dereference {assembly/project} {project to remove reference from}"); return; } if (!_project.Read(projectFile, _getTypesProviderByLocation)) return; _project.Dereference(file); _project.Write(); writer.Write("Rereferenced {0} from {1}", file, projectFile); }
public void Execute(IResponseWriter writer, string[] arguments) { if (arguments.Length != 2) { writer.Write("error|The handler needs the full path to the reference. " + "Usage: reference {assembly/project} {project to add reference to"); return; } var fullpath = getFile(arguments[0]); IFile file; if (new VSProjectFile().SupportsExtension(fullpath)) file = new VSProjectFile().New(fullpath); else file = new AssemblyFile().New(fullpath); var projectFile = getFile(arguments[1]); if (!File.Exists(projectFile)) { writer.Write("error|The project to add this reference to does not exist. " + "Usage: reference {assembly/project} {project to add reference to"); return; } if (!_project.Read(projectFile, _provider)) return; _project.Reference(file); _project.Write(); writer.Write("Added reference {0} to {1}", file, projectFile); }
public void Execute(IResponseWriter writer, string[] arguments) { if (arguments.Length < 1) { writer.Write("error|The handler needs the full path to the reference. " + "Usage: reference REFERENCE [PROJECT]"); return; } if (arguments.Length > 1) { var projectFile = getFile(arguments[1]); if (!File.Exists(projectFile)) { writer.Write("error|The project to add this reference to does not exist. " + "Usage: reference REFERENCE [PROJECT]"); return; } if (!_project.Read(projectFile, _provider)) return; } else { if (!_project.Read(Environment.CurrentDirectory, _provider)) { writer.Write("error|Could not locate project within " + Environment.CurrentDirectory + ". " + "Usage: reference REFERENCE [PROJECT]"); return; } } var fullpath = new PathParser(arguments[0]).ToAbsolute(Environment.CurrentDirectory); IFile file; if (new VSProjectFile().SupportsExtension(fullpath)) file = new VSProjectFile().New(fullpath); else file = new AssemblyFile().New(fullpath); _project.Reference(file); _project.Write(); writer.Write("Added reference {0} to {1}", fullpath, _project.Fullpath); }
public void Execute(IResponseWriter writer, string[] arguments) { if (arguments.Length < 1) { writer.Write("error|The handler needs the full path to the reference. " + "Usage: dereference REFERENCE [PROJECT"); return; } if (arguments.Length > 1) { var projectFile = getFile(arguments[1]); if (!File.Exists(projectFile)) { writer.Write("error|The project to remove this reference for does not exist. " + "Usage: dereference REFERENCE [PROJECT"); return; } if (!_project.Read(projectFile, _getTypesProviderByLocation)) return; } else { if (!_project.Read(Environment.CurrentDirectory, _getTypesProviderByLocation)) { writer.Write("error|Could not locate project within " + Environment.CurrentDirectory + ". " + "Usage: dereference REFERENCE [PROJECT]"); return; } } var fullpath = getFile(arguments[0]); IFile file; if (new VSProjectFile().SupportsExtension(fullpath)) file = new VSProjectFile().New(fullpath); else file = new AssemblyFile().New(fullpath); _project.Dereference(file); _project.Write(); writer.Write("Rereferenced {0} from {1}", fullpath, _project.Fullpath); }