Exemplo n.º 1
0
        public void TestCsprojDebug()
        {
            ProjectFileHelper helper = new ProjectFileHelper("test.csproj");

            string config = "debug";
            //read tests

            string DefineConstants = helper.GetProperty("DefineConstants", config);

            Assert.AreEqual(DefineConstants, "DEBUG;TRACE");

            string WarningLevel = helper.GetProperty("WarningLevel", config);

            Assert.AreEqual(WarningLevel, "7");

            //set tests
            helper.SetProperty("DefineConstants", "Test Debug Defines", config);
            helper.SetProperty("WarningLevel", "8", config);

            helper.Save();
            helper.Reload();

            DefineConstants = helper.GetProperty("DefineConstants", config);
            Assert.AreEqual(DefineConstants, "Test Debug Defines");

            WarningLevel = helper.GetProperty("WarningLevel", config);
            Assert.AreEqual(WarningLevel, "8");

            //reset to default value
            helper.SetProperty("DefineConstants", "DEBUG;TRACE", config);
            helper.SetProperty("WarningLevel", "7", config);
            helper.Save();
        }
Exemplo n.º 2
0
        public void TestRelease()
        {
            ProjectFileHelper helper = new ProjectFileHelper("test.csproj");

            string config = "release";
            //read tests

            string DefineConstants = helper.GetProperty("DefineConstants", config);

            Assert.AreEqual(DefineConstants, "TRACE");

            string WarningLevel = helper.GetProperty("WarningLevel", config);

            Assert.AreEqual(WarningLevel, "4");

            //set tests
            helper.SetProperty("DefineConstants", "Test Release Defines", config);
            helper.SetProperty("WarningLevel", "5", config);

            helper.Save();
            helper.Reload();

            DefineConstants = helper.GetProperty("DefineConstants", config);
            Assert.AreEqual(DefineConstants, "Test Release Defines");

            WarningLevel = helper.GetProperty("WarningLevel", config);
            Assert.AreEqual(WarningLevel, "5");

            //reset to default value
            helper.SetProperty("DefineConstants", "TRACE", config);
            helper.SetProperty("WarningLevel", "4", config);
            helper.Save();
        }
Exemplo n.º 3
0
        public void TestCsprojGlobal()
        {
            ProjectFileHelper helper = new ProjectFileHelper("test.csproj");

            string config = "debug";

            //read tests
            string AssemblyName = helper.GetProperty("AssemblyName", config);

            Assert.AreEqual(AssemblyName, "AppExeName");

            string RootNamespace = helper.GetProperty("RootNamespace", config);

            Assert.AreEqual(RootNamespace, "Com.App.Desktop");

            string PublishUrl = helper.GetProperty("PublishUrl", config);

            Assert.AreEqual(PublishUrl, "publish\\");

            //set tests
            helper.SetProperty("AssemblyName", "test assmbly name", config);
            helper.SetProperty("RootNamespace", "test root namespace", config);
            helper.SetProperty("PublishUrl", "test publish urls", config);

            helper.Save();
            helper.Reload();

            AssemblyName = helper.GetProperty("AssemblyName", config);
            Assert.AreEqual(AssemblyName, "test assmbly name");

            RootNamespace = helper.GetProperty("RootNamespace", config);
            Assert.AreEqual(RootNamespace, "test root namespace");

            PublishUrl = helper.GetProperty("PublishUrl", config);
            Assert.AreEqual(PublishUrl, "test publish urls");

            //reset to default value
            helper.SetProperty("AssemblyName", "AppExeName", config);
            helper.SetProperty("RootNamespace", "Com.App.Desktop", config);
            helper.SetProperty("PublishUrl", "publish\\", config);
            helper.Save();
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            if (args.Length < 1)
            {
                Console.WriteLine("Usage:killpdb <something.sln>");
            }
            else
            {
                //https://stackoverflow.com/questions/707107/parsing-visual-studio-solution-files

                var solutionFile = SolutionFile.Parse(Path.GetFullPath(args[0]));
                var projList     = solutionFile.ProjectsInOrder.ToList();
                var configList   = new string[] { "Debug", "Release" };
                foreach (var prj in projList)
                {
                    //<GenerateDebugInformation>true</GenerateDebugInformation>
                    try
                    {
                        bool changed = false;
                        var  path    = Path.GetExtension(prj.RelativePath);
                        if (path.Equals(".vcxproj"))
                        {
                            ProjectFileHelper helper = new ProjectFileHelper(prj.RelativePath);
                            var cnt = helper.SetAllProperty("GenerateDebugInformation", "false");
                            Console.WriteLine($"{prj.ProjectName} => {cnt} ");

                            if (cnt > 0)
                            {
                                helper.Save();
                            }
                        }
                        else
                        {
                        }
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e);
                        throw;
                    }
                }
            }
        }
Exemplo n.º 5
0
        public void TestVcxprojReleaseX64()
        {
            ProjectFileHelper helper = new ProjectFileHelper("cpulspuls.vcxproj");

            string config   = "release";
            string platform = "x64";

            //read tests
            string def = helper.GetProperty("PreprocessorDefinitions", config, platform);

            string newdef = "DX_11_M;" + def;

            //set tests
            helper.SetProperty("PreprocessorDefinitions", newdef, config, platform);

            helper.Save();

            helper.Reload();

            string rdef = helper.GetProperty("PreprocessorDefinitions", config, platform);

            Assert.AreEqual(rdef, newdef);
        }