Exemple #1
0
        protected override void Execute()
        {
            if (SharePointRegistry.Instance.SharePointRootLocation != null)
            {
                SelectedItems items = this.DTEInstance.Application.SelectedItems;

                foreach (SelectedItem item in items)
                {
                    StringBuilder arguments    = new StringBuilder();
                    string        targetFolder = string.Empty;

                    string path = string.Empty;

                    ProjectPaths projectPaths = new ProjectPaths(this.DTEInstance.GetProject(item));

                    if (projectPaths.DoSharePointRootExist())
                    {
                        if (item.ProjectItem != null)
                        {
                            string featurefilename = item.ProjectItem.Properties.Item("FullPath").Value.ToString();
                            path = Path.GetFullPath(featurefilename);

                            string subSPPath = path.Substring(projectPaths.PathSharePointRoot.Length);
                            targetFolder = Utility.CombinePaths(SharePointRegistry.Instance.SharePointRootLocation, subSPPath);
                        }
                        else
                        {
                            // Use the project 12 folder
                            path         = projectPaths.PathSharePointRoot;
                            targetFolder = SharePointRegistry.Instance.SharePointRootLocation;
                        }

                        if (ContainsXmlFiles(path))
                        {
                            // First recycle all Application pools
                            AppPoolHandle appPools = new AppPoolHandle(this.DTEInstance);
                            appPools.RecycleAppPools();
                        }

                        string program = "xcopy";

                        this.DTEInstance.StatusBar("xcopy started");

                        arguments.Append("\"" + Utility.RemoveTailingBackSlash(path) + "\"");

                        arguments.Append(" \"" + Utility.RemoveTailingBackSlash(targetFolder) + "\"");
                        arguments.Append(@" /E /R /Y");

                        ExternalProgram externalProgram = new ExternalProgram(this.DTEInstance);
                        externalProgram.RunAsync(program, arguments.ToString());
                    }
                }

                this.DTEInstance.StatusBar("Done xcopy!");
            }
        }
        protected override void Execute()
        {
            this.DTEInstance.BuildWindow.Clear();
            this.DTEInstance.BuildWindow.Activate();

            AppPoolHandle appPools = new AppPoolHandle(this.DTEInstance);

            appPools.RecycleAppPools();

            this.DTEInstance.WriteBuildAndStatusBar("Done recycling Application pools!");
        }
Exemple #3
0
        protected override void Execute()
        {
            WSPFileHandle wspHandle = new WSPFileHandle(this.DTEInstance);

            DialogResult result = DialogResult.No;

            if (result != DialogResult.Cancel)
            {
                if (result == DialogResult.Yes)
                {
                    this.DTEInstance.Application.Solution.SolutionBuild.Build(true);
                    if (this.DTEInstance.Application.Solution.SolutionBuild.LastBuildInfo > 0)
                    {
                        MessageBox.Show("Build Failed. Unable to deploy");
                        return; // Exit
                    }
                }

                this.DTEInstance.BuildWindow.Clear();
                this.DTEInstance.BuildWindow.Activate();

                // First recycle all Application pools
                AppPoolHandle appPools = new AppPoolHandle(this.DTEInstance);
                appPools.RecycleAppPools();

                // Should the owstimer service be recycled?
                // Should the Admin service be recycled?


                // Copy to Global Assembly Cache.
                // Install the assembly into the GAC with force
                // --------------------------------------------
                ProjectPaths projectPaths = new ProjectPaths(this.DTEInstance.SelectedProject);

                int      count      = 0;
                bool     errorFound = false;
                string[] dllFiles   = GetDLLS(projectPaths.OutputPathDLL);

                foreach (string dllPath in dllFiles)
                {
                    if (dllPath.EndsWith("Microsoft.SharePoint.dll", StringComparison.OrdinalIgnoreCase) ||
                        dllPath.EndsWith("Microsoft.SharePoint.Security.dll", StringComparison.OrdinalIgnoreCase) ||
                        dllPath.EndsWith("Microsoft.SharePoint.Search.dll", StringComparison.InvariantCultureIgnoreCase) ||
                        dllPath.EndsWith("Microsoft.Office.Server.Search.dll", StringComparison.InvariantCultureIgnoreCase)
                        )
                    {
                        // Do not include Microsoft dlls
                        continue;
                    }
                    else
                    {
                        InstallAssemblyIntoGAC(dllPath);
                    }

                    count++;
                }

                if (errorFound)
                {
                    this.DTEInstance.WriteBuildAndStatusBar("Error copying to Global Assembly Cache!");
                }
                else
                {
                    if (count > 0)
                    {
                        this.DTEInstance.WriteBuildAndStatusBar("Done copy to Global Assembly Cache!");
                    }
                    else
                    {
                        this.DTEInstance.WriteBuildAndStatusBar("No DLL's found!");
                    }
                }
            }
        }