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 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 (!Directory.Exists(publishPath)) { throw new NotSupportedException($"Path '{publishPath}' does not exist, please create or update path."); } var publishOutput = DotnetCliHelper.Publish(projectPath, configuration, projectFileName, publishPath); OutputHelper.WriteToOutput(publishOutput); }
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); }