public Deployment Find(string assemblyName) { var pathToSearch = AppDomain.CurrentDomain.BaseDirectory; var ass = Directory.GetFiles(pathToSearch); var deploymentAssemblyCandidates = ass.Where(x => x.Contains("Deployment") && (Path.GetExtension(x) == ".dll" || Path.GetExtension(x) == ".exe")); Deployment deployment = new NullDeployment(); foreach (var candidate in deploymentAssemblyCandidates) { deployment = new AssemblyWasSpecifiedAssumingOnlyOneDeploymentClass().Find(candidate); if (deployment.GetType() != typeof(NullDeployment)) return deployment; } return deployment; }
public Deployment Find(string assemblyName) { var pathToSearch = AppDomain.CurrentDomain.BaseDirectory; var ass = Directory.GetFiles(pathToSearch); var deploymentAssemblyCandidates = ass.Where(x => x.Contains("Deployment") && (Path.GetExtension(x) == ".dll" || Path.GetExtension(x) == ".exe")); Deployment deployment = new NullDeployment(); foreach (var candidate in deploymentAssemblyCandidates) { deployment = new AssemblyWasSpecifiedAssumingOnlyOneDeploymentClass().Find(candidate); if (deployment.GetType() != typeof(NullDeployment)) { return(deployment); } } return(deployment); }