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);
        }
예제 #2
0
        public static void Execute(IServiceProvider serviceProvider)
        {
            Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();

            var dte             = serviceProvider.GetService(typeof(DTE)) as DTE;
            var projectPath     = ProjectHelper.GetCurrentProjectPath(dte);
            var projectName     = ProjectHelper.GetCurrentProjectName(dte);
            var projectFileName = ProjectHelper.GetCurrentProjectFileName(dte);
            var targetFramework = ProjectHelper.GetTargetFrameworkFromProject(dte);
            var nuspecFileName  = $"{projectFileName.Split(new[] { ".csproj" }, StringSplitOptions.RemoveEmptyEntries)[0]}.nuspec";

            File.WriteAllText(Path.Combine(projectPath, nuspecFileName), ExampleNuspecFile(projectName, targetFramework));
        }
        public static void Execute(IServiceProvider serviceProvider)
        {
            var dte         = serviceProvider.GetService(typeof(DTE)) as DTE;
            var projectPath = ProjectHelper.GetCurrentProjectPath(dte);
            var options     = new PrisePluginFile
            {
                PublishDir    = "<path to host application .\\bin\\Debug\\netcoreappx.x\\Plugins>",
                Configuration = "Debug"
            };

            var asJson = JsonConvert.SerializeObject(options, Formatting.Indented);

            File.WriteAllText(Path.Combine(projectPath, "prise.plugin.json"), asJson);
        }
예제 #4
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);
        }