示例#1
0
        public static void Execute(IServiceProvider serviceProvider)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            var dte     = serviceProvider.GetService(typeof(DTE)) as DTE;
            var options = ProjectHelper.GetPrisePluginFileFromSelectedProject(dte);

            var projectPath     = ProjectHelper.GetCurrentProjectPath(dte);
            var projectName     = ProjectHelper.GetCurrentProjectName(dte);
            var projectFileName = ProjectHelper.GetCurrentProjectFileName(dte);
            var targetFramework = ProjectHelper.GetTargetFrameworkFromProject(dte);
            var nuspecFile      = $"{projectFileName.Split(new[] { ".csproj" }, StringSplitOptions.RemoveEmptyEntries)[0]}.nuspec";
            var publishPath     = Path.IsPathRooted(options.PublishDir) ? options.PublishDir : Path.GetFullPath(Path.Combine(projectPath, options.PublishDir));
            var configuration   = !String.IsNullOrEmpty(options.Configuration) ? options.Configuration : "Debug";

            if (options.IncludeProjectNameInPublishDir)
            {
                publishPath = Path.Combine(publishPath, projectName);
            }

            if (!String.IsNullOrEmpty(options.NuspecFile))
            {
                nuspecFile = Path.IsPathRooted(options.NuspecFile) ? options.NuspecFile : Path.GetFullPath(Path.Combine(projectPath, options.NuspecFile));
            }

            if (!Directory.Exists(publishPath))
            {
                throw new NotSupportedException($"Path '{publishPath}' does not exist, please create or update path.");
            }

            var publishOutput = DotnetCliHelper.Publish(projectPath, configuration, projectFileName);

            OutputHelper.WriteToOutput(publishOutput);

            var timestampFixOutput = PowershellHelper.FixUpdateLastWriteTime(projectPath, configuration, targetFramework);

            OutputHelper.WriteToOutput(timestampFixOutput);

            var packOutput = DotnetCliHelper.Pack(projectPath, configuration, projectFileName, publishPath, nuspecFile);

            OutputHelper.WriteToOutput(packOutput);
        }
 private void MenuItem_BeforeQueryStatus(object sender, EventArgs e) =>
 ((OleMenuCommand)sender).Enabled = ProjectHelper.DoesPrisePluginFileExist(_dte);
示例#3
0
 private void MenuItem_BeforeQueryStatus(object sender, EventArgs e) =>
 ((OleMenuCommand)sender).Enabled = ProjectHelper.DoesAtLeastOneNuspecFileExist(_dte);
示例#4
0
 private void MenuItem_BeforeQueryStatus(object sender, EventArgs e) =>
 ((OleMenuCommand)sender).Visible = ProjectHelper.ShouldBeVisible(GetService(typeof(DTE)) as DTE);