Пример #1
0
        public WorkspaceItem ReloadItem(IProgressMonitor monitor, WorkspaceItem item)
        {
            if (Items.IndexOf(item) == -1)
            {
                throw new InvalidOperationException("Item '" + item.Name + "' does not belong to workspace '" + Name + "'");
            }

            // Load the new item

            WorkspaceItem newItem;

            try {
                newItem = Services.ProjectService.ReadWorkspaceItem(monitor, item.FileName);
            } catch (Exception ex) {
                UnknownWorkspaceItem e = new UnknownWorkspaceItem();
                e.LoadError = ex.Message;
                e.FileName  = item.FileName;
                newItem     = e;
            }

            // Replace in the file list
            Items.Replace(item, newItem);

            NotifyModified();
            NotifyItemRemoved(new WorkspaceItemChangeEventArgs(item, true));
            NotifyItemAdded(new WorkspaceItemChangeEventArgs(newItem, true));

            item.Dispose();
            return(newItem);
        }
Пример #2
0
        public async Task LocalCopyDefault()
        {
            string solFile = Util.GetSampleProject("local-copy-package", "ConsoleProject.sln");

            WorkspaceItem item = await Services.ProjectService.ReadWorkspaceItem(Util.GetMonitor(), solFile);

            Solution sol = (Solution)item;
            var      p   = (DotNetProject)sol.Items [0];

            var ar = p.References.First(r => r.Reference.Contains("gtk"));

            if (!ar.Package.IsGacPackage)
            {
                Assert.Ignore("This test only works with gtk-sharp as a GAC package.");
            }

            Assert.AreEqual(false, ar.LocalCopy);
            ar.LocalCopy = true;
            Assert.AreEqual(true, ar.LocalCopy);

            ar = p.References.First(r => r.Reference.Contains("System.Data"));
            Assert.AreEqual(false, ar.LocalCopy);
            ar.LocalCopy = true;
            Assert.AreEqual(true, ar.LocalCopy);

            ar = p.References.First(r => r.Reference.Contains("LibProject"));
            Assert.AreEqual(true, ar.LocalCopy);
            ar.LocalCopy = false;
            Assert.AreEqual(false, ar.LocalCopy);

            ar = p.References.First(r => r.Reference.Contains("Xwt"));
            Assert.AreEqual(true, ar.LocalCopy);
            ar.LocalCopy = false;
            Assert.AreEqual(false, ar.LocalCopy);

            await sol.SaveAsync(new ProgressMonitor());

            await sol.Build(new ProgressMonitor(), "Debug");

            AssertOutputFiles(sol, "ConsoleProject", "Debug", new string[] {
                "ConsoleProject.exe",
                p.GetAssemblyDebugInfoFile(sol.Configurations["Debug"].Selector, "ConsoleProject.exe"),
                "System.Data.dll",
                "gtk-sharp.dll",
                "gtk-sharp.dll.config",
                "gtk-sharp.pdb",
            });

            string projectXml1 = Util.GetXmlFileInfoset(p.FileName.ParentDirectory.Combine("ConsoleProject.csproj.saved"));
            string projectXml2 = Util.GetXmlFileInfoset(p.FileName);

            Assert.AreEqual(projectXml1, projectXml2);

            item.Dispose();
        }
Пример #3
0
        public async Task CheckLocalCopy()
        {
            Assert.Inconclusive("This test is failing on windows and mac");

            string solFile = Util.GetSampleProject("vs-local-copy", "VSLocalCopyTest.sln");

            WorkspaceItem item = await Services.ProjectService.ReadWorkspaceItem(Util.GetMonitor(), solFile);

            Assert.IsTrue(item is Solution);
            Solution sol = (Solution)item;

            await AssertCleanBuild(sol, "Debug");
            await AssertCleanBuild(sol, "Release");

            string dllDebug = Platform.IsWindows ? ".pdb" : ".dll.mdb";
            string exeDebug = Platform.IsWindows ? ".pdb" : ".exe.mdb";

            AssertOutputFiles(sol, "VSLocalCopyTest", "Debug", new string[] {
                "ClassLibrary1.dll",
                "ClassLibrary1" + dllDebug,
                "ClassLibrary2.dll",
                "ClassLibrary2" + dllDebug,
                "ClassLibrary4.dll",
                "ClassLibrary4" + dllDebug,
                "VSLocalCopyTest.exe",
                "VSLocalCopyTest" + exeDebug,
                "TextFile1.txt",
                "TextFile2.txt",
                "app.config",
                "folder/baz.txt",
                "foo/bar.txt",
                "quux.txt",
                "VSLocalCopyTest.exe.config",
            });

            //FIXME: all of these should have mdb files in release mode.
            //See [Bug 431451] MD ignores DebugType pdbonly
            AssertOutputFiles(sol, "VSLocalCopyTest", "Release", new string[] {
                "ClassLibrary1.dll",
                "ClassLibrary2.dll",
                "ClassLibrary4.dll",
                "VSLocalCopyTest.exe",
                "TextFile1.txt",
                "TextFile2.txt",
                "app.config",
                "folder/baz.txt",
                "foo/bar.txt",
                "quux.txt",
                "VSLocalCopyTest.exe.config",
            });

            AssertOutputFiles(sol, "ClassLibrary1", "Debug", new string[] {
                "ClassLibrary1.dll",
                "ClassLibrary1" + dllDebug,
                "ClassLibrary2.dll",
                "ClassLibrary2" + dllDebug,
                "TextFile1.txt",
                "TextFile2.txt",
                "foo/bar.txt",
            });

            AssertOutputFiles(sol, "ClassLibrary1", "Release", new string[] {
                "ClassLibrary1.dll",
                "ClassLibrary2.dll",
                "TextFile1.txt",
                "TextFile2.txt",
                "foo/bar.txt",
            });

            AssertOutputFiles(sol, "ClassLibrary2", "Debug", new string[] {
                "ClassLibrary2.dll",
                "ClassLibrary2" + dllDebug,
                "TextFile2.txt"
            });

            AssertOutputFiles(sol, "ClassLibrary2", "Release", new string[] {
                "ClassLibrary2.dll",
                "TextFile2.txt"
            });

            AssertOutputFiles(sol, "ClassLibrary3", "Debug", new string[] {
                "ClassLibrary3.dll",
                "ClassLibrary3" + dllDebug
            });

            AssertOutputFiles(sol, "ClassLibrary3", "Release", new string[] {
                "ClassLibrary3.dll"
            });

            AssertOutputFiles(sol, "ClassLibrary4", "Debug", new string[] {
                "ClassLibrary4.dll",
                "ClassLibrary4" + dllDebug
            });

            AssertOutputFiles(sol, "ClassLibrary4", "Release", new string[] {
                "ClassLibrary4.dll"
            });

            AssertOutputFiles(sol, "ClassLibrary5", "Debug", new string[] {
                "ClassLibrary5.dll",
                "ClassLibrary5" + dllDebug,
            });

            AssertOutputFiles(sol, "ClassLibrary5", "Release", new string[] {
                "ClassLibrary5.dll"
            });

            item.Dispose();
        }