public void SetUp()
        {
            theFilename = "Bottles.txt";
            var stream = GetType()
                .Assembly
                .GetManifestResourceStream(GetType(), "ProjectTemplate.txt");

            new FileSystem().WriteStreamToFile(theFilename, stream);

            theProj = new ProjFile(theFilename, null);

            theProj
                .References
                .ShouldHaveTheSameElementKeysAs(new[]
                {
                    "FubuCore", 
                    "Ionic.Zip", 
                    "Ionic.Zip, Version=1.9.1.8, Culture=neutral, processorArchitecture=MSIL",
                    "System",
                    "System.Core",
                    "System.Web",
                    "System.Xml",
                    "yeti"
                }, x => x.Include);

            theProj.RemoveDuplicateReferences();
            theProj.Write();

            theProj = null;
            theProj = new ProjFile(theFilename, null);
        }
        public void SetUp()
        {
            theFilename = "Bottles.txt";
            var stream = GetType()
                         .Assembly
                         .GetManifestResourceStream(GetType(), "ProjectTemplate.txt");

            new FileSystem().WriteStreamToFile(theFilename, stream);

            theProj = new ProjFile(theFilename, null);

            theProj
            .References
            .ShouldHaveTheSameElementKeysAs(new[]
            {
                "FubuCore",
                "Ionic.Zip",
                "Ionic.Zip, Version=1.9.1.8, Culture=neutral, processorArchitecture=MSIL",
                "System",
                "System.Core",
                "System.Web",
                "System.Xml",
                "yeti"
            }, x => x.Include);

            theProj.RemoveDuplicateReferences();
            theProj.Write();

            theProj = null;
            theProj = new ProjFile(theFilename, null);
        }
        public void SetUp()
        {
            theFilename = "Bottles.txt";
            var stream = GetType()
                         .Assembly
                         .GetManifestResourceStream(GetType(), "ProjectWithProjectRefs.txt");

            new FileSystem().WriteStreamToFile(theFilename, stream);

            theProj = new ProjFile(theFilename, null);
        }
        public void SetUp()
        {
            theFilename = "Bottles.txt";
            var stream = GetType()
                .Assembly
                .GetManifestResourceStream(GetType(), "ProjectWithProjectRefs.txt");

            new FileSystem().WriteStreamToFile(theFilename, stream);

            theProj = new ProjFile(theFilename, null);
        }
        public static FrameworkName Detect(ProjFile project)
        {
            var groups = project.Document.XPathSelectElements("tns:PropertyGroup", ProjFile.Manager).ToArray();

            var identifier = groups.Get("TargetFrameworkIdentifier", DefaultIdentifier);
            var versionString = groups.Get("TargetFrameworkVersion", DefaultFrameworkVersion);
            var profile = groups.Get("TargetFrameworkProfile");
            var version = Version.Parse(versionString.Replace("v", "").Replace("V", ""));

            return new FrameworkName(identifier, version, profile);
        }
        public void SetUp()
        {
            theFilename = "Test.txt";
            var stream = GetType()
                .Assembly
                .GetManifestResourceStream(GetType(), "ProjectWithDuplicateRefs.txt");

            new FileSystem().WriteStreamToFile(theFilename, stream);

            theProj = new ProjFile(theFilename, null);

            theProj
                .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.Include);

            theProj.RemoveDuplicateReferences();
            theProj.Write();

            theProj = null;
            theProj = new ProjFile(theFilename, null);
        }
        public void SetUp()
        {
            theFilename = "Test.txt";
            var stream = GetType()
                         .Assembly
                         .GetManifestResourceStream(GetType(), "ProjectWithDuplicateRefs.txt");

            new FileSystem().WriteStreamToFile(theFilename, stream);

            theProj = new ProjFile(theFilename, null);

            theProj
            .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.Include);

            theProj.RemoveDuplicateReferences();
            theProj.Write();

            theProj = null;
            theProj = new ProjFile(theFilename, null);
        }
        public void convert_to_ripple_dependencies_config()
        {
            theFilename = "TestProject.txt";
            var stream = GetType()
                         .Assembly
                         .GetManifestResourceStream(GetType(), "ProjectWithPackagesConfig.txt");

            new FileSystem().WriteStreamToFile(theFilename, stream);

            theProj = new ProjFile(theFilename, null);
            theProj.UsesPackagesConfig().ShouldBeTrue();

            theProj.ConvertToRippleDependenciesConfig();
            theProj.Write();

            theProj = null;
            theProj = new ProjFile(theFilename, null);

            theProj.UsesPackagesConfig().ShouldBeFalse();
        }
        public void convert_to_ripple_dependencies_config()
        {
            theFilename = "TestProject.txt";
            var stream = GetType()
                .Assembly
                .GetManifestResourceStream(GetType(), "ProjectWithPackagesConfig.txt");

            new FileSystem().WriteStreamToFile(theFilename, stream);

            theProj = new ProjFile(theFilename, null);
            theProj.UsesPackagesConfig().ShouldBeTrue();

            theProj.ConvertToRippleDependenciesConfig();
            theProj.Write();

            theProj = null;
            theProj = new ProjFile(theFilename, null);

            theProj.UsesPackagesConfig().ShouldBeFalse();
        }
Example #10
0
        /// <summary>
        /// Drafts the two typical lines found, per project, in a .sln file.
        /// </summary>
        /// <param name="projFile">
        /// If the projFile has its <see cref="ProjFile.GetMainProjectTypeGuid()"/> property assigned then
        /// that value is used; elsewise, a match is looked up in <see cref="VisualStudioProjTypeGuids"/>
        /// </param>
        /// <param name="slnDir"></param>
        /// <returns></returns>
        public static string GetSlnProjectEntry(ProjFile projFile, string slnDir)
        {
            var projExt = Path.GetExtension(projFile.FileName);

            if (string.IsNullOrWhiteSpace(projExt))
            {
                return(null);
            }

            var projGuid = projFile.ProjectGuid;

            if (string.IsNullOrWhiteSpace(projGuid))
            {
                return(null);
            }

            if (string.IsNullOrWhiteSpace(projFile.GetMainProjectTypeGuid()) && !VisualStudioProjTypeGuids.ContainsKey(projExt))
            {
                throw new NotImplementedException("There is no VS Project Type Guid defined for " +
                                                  $"a '{projExt}' file type.  Assign the ProjFile's " +
                                                  "VsProjectTypeGuids directly.");
            }

            var projTypeGuid = projFile.GetMainProjectTypeGuid() ?? VisualStudioProjTypeGuids[projExt];

            var projName = Path.GetFileNameWithoutExtension(projFile.FileName);

            var projFileFullName = Path.Combine(projFile.DirectoryName, projFile.FileName);
            var projRelFullName  = projFileFullName;

            NfPath.TryGetRelPath(slnDir, ref projRelFullName);

            var projBldr = new StringBuilder();

            projBldr.AppendLine(
                $"Project(\"{projTypeGuid}\") = \"{projName}\", \"{projRelFullName}\", \"{projGuid}\"");
            projBldr.AppendLine("EndProject");
            return(projBldr.ToString());
        }