public void SetUp() { theFilename = "Bottles.txt"; var stream = GetType() .Assembly .GetManifestResourceStream(GetType(), "ProjectTemplate.txt"); new FileSystem().WriteStreamToFile(theFilename, stream); theCsProj = new CsProjFile(theFilename, null); theCsProj .References .ShouldHaveTheSameElementKeysAs(new[] { "FubuCore", "Ionic.Zip", "Ionic.Zip, Version=1.9.1.8, Culture=neutral, processorArchitecture=MSIL", "System", "System.Core", "System.Web", "System.Xml" }, x => x.Name); theCsProj.RemoveDuplicateReferences(); theCsProj.Write(); theCsProj = null; theCsProj = new CsProjFile(theFilename, null); }
public void SetUp() { theFilename = "Bottles.txt"; var stream = GetType() .Assembly .GetManifestResourceStream(GetType(), "ProjectWithProjectRefs.txt"); new FileSystem().WriteStreamToFile(theFilename, stream); theCsProj = new CsProjFile(theFilename, null); }
public ProjFile(string filename, Solution solution) { _filename = filename; _solution = solution; if (File.Exists(_filename)) { _project = CsProjFile.LoadFrom(_filename); } else { _project = CsProjFile.CreateAtLocation(_filename, solution.Name); } }
public void convert_to_ripple_dependencies_config() { theFilename = "TestProject.txt"; var stream = GetType() .Assembly .GetManifestResourceStream(GetType(), "ProjectWithPackagesConfig.txt"); new FileSystem().WriteStreamToFile(theFilename, stream); theCsProj = new CsProjFile(theFilename, null); theCsProj.UsesPackagesConfig().ShouldBeTrue(); theCsProj.ConvertToRippleDependenciesConfig(); theCsProj.Write(); theCsProj = null; theCsProj = new CsProjFile(theFilename, null); theCsProj.UsesPackagesConfig().ShouldBeFalse(); }
private void fixProject(Project project) { project = Project.ReadFrom(project.ProjectFile); var file = new CsProjFile(project.ProjectFile); project.NugetDependencies.Each(dep => { var package = _packages[dep.Name]; if (package == null) { Console.WriteLine("Could not find the IPackage for " + dep.Name); return; } var assemblies = package.AssemblyReferences; if (assemblies == null) return; file.AddAssemblies(dep, assemblies); }); }
private void fixProject(Project project) { project = Project.ReadFrom(project.ProjectFile); var file = new CsProjFile(project.ProjectFile); bool needsSaved = false; project.NugetDependencies.Each(dep => { var package = _packages[dep.Name]; if (package == null) { Console.WriteLine("Could not find the IPackage for " + dep.Name); return; } var assemblies = package.AssemblyReferences; if (assemblies == null) return; assemblies.Each(assem => { var assemblyName = Path.GetFileNameWithoutExtension(assem.Name); if (assemblyName.StartsWith("System.")) return; if (assemblyName == "_._") return; var hintPath = Path.Combine("..", "packages", dep.ToNugetFolderName(), assem.Path); if (file.References.Any(x => x.Matches(assemblyName))) return; if (file.AddReference(assemblyName, hintPath) == ReferenceStatus.Changed) { Console.WriteLine("Updated reference for {0} to {1}", project.ProjectFile, hintPath); needsSaved = true; } }); }); if (needsSaved) { Console.WriteLine("Writing changes to " + file); file.Write(); } }
public void SetUp() { theFilename = "Test.txt"; var stream = GetType() .Assembly .GetManifestResourceStream(GetType(), "ProjectWithDuplicateRefs.txt"); new FileSystem().WriteStreamToFile(theFilename, stream); theCsProj = new CsProjFile(theFilename, null); theCsProj .References .ShouldHaveTheSameElementKeysAs(new[] { "Bottles", "FubuCore", "FubuLocalization", "FubuMVC.Core", "FubuMVC.Core.Assets", "FubuMVC.Core.UI", "FubuMVC.Core.View", "FubuMVC.JQueryUI", "FubuMVC.Media", "FubuMVC.StructureMap", "FubuTestingSupport", "HtmlTags", "Microsoft.CSharp", "nunit.framework", "nunit.framework, Version=2.5.10.11092, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL", "nunit.mocks", "nunit.mocks, Version=2.5.10.11092, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL", "pnunit.framework", "pnunit.framework, Version=1.0.4109.34242, Culture=neutral, processorArchitecture=MSIL", "Rhino.Mocks", "Rhino.Mocks, Version=3.6.0.0, Culture=neutral, PublicKeyToken=0b3305902db7183f, processorArchitecture=MSIL", "StructureMap", "StructureMap.AutoMocking", "StructureMap.AutoMocking, Version=2.6.3.0, Culture=neutral, PublicKeyToken=e60ad81abae3c223, processorArchitecture=MSIL", "System", "System.Core", "System.Data", "System.Data.DataSetExtensions", "System.Xml", "System.Xml.Linq" }, x => x.Name); theCsProj.RemoveDuplicateReferences(); theCsProj.Write(); theCsProj = null; theCsProj = new CsProjFile(theFilename, null); }