Using Azure DevOps pipeline build for publishing a single-exe Greenshot

This commit is contained in:
Robin Krom 2019-04-29 22:52:19 +02:00
commit 61d6e7558d
4 changed files with 51 additions and 23 deletions

View file

@ -29,20 +29,31 @@ steps:
restoreSolution: '$(solution)' restoreSolution: '$(solution)'
feedsToUse: config feedsToUse: config
- task: VSBuild@1 - task: DotNetCoreCLI@2
displayName: 'Build solution **\*.sln' displayName: Publish single-exe x64
inputs: inputs:
vsVersion: 'latest' command: 'publish'
solution: '$(solution)' publishWebProjects: false
platform: '$(buildPlatform)' projects: 'src\Greenshot\Greenshot.csproj'
configuration: '$(buildConfiguration)' arguments: '-f netcoreapp3.0 -c Release /p:PublishSingleFile=true /p:UseAppHost=true /p:RuntimeIdentifier=win-x64'
zipAfterPublish: false
- task: DotNetCoreCLI@2
displayName: Publish single-exe x86
inputs:
command: 'publish'
publishWebProjects: false
projects: 'src\Greenshot\Greenshot.csproj'
arguments: '-f netcoreapp3.0 -c Release /p:PublishSingleFile=true /p:UseAppHost=true /p:RuntimeIdentifier=win-x86'
zipAfterPublish: false
- task: CopyFiles@2 - task: CopyFiles@2
displayName: 'Copy Files to: $(build.artifactstagingdirectory)' displayName: 'Copy Files to: $(build.artifactstagingdirectory)'
inputs: inputs:
SourceFolder: '$(Build.SourcesDirectory)\src\Greenshot\bin\$(BuildConfiguration)' SourceFolder: '$(Build.SourcesDirectory)\src\Greenshot\bin\Release\netcoreapp3.0'
Contents: | Contents: |
** win-x64\publish\Greenshot.exe
win-x86\publish\Greenshot.exe
TargetFolder: '$(build.artifactstagingdirectory)' TargetFolder: '$(build.artifactstagingdirectory)'
flattenFolders: false flattenFolders: false

View file

@ -57,7 +57,7 @@
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-18618-05" PrivateAssets="All"/> <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-18618-05" PrivateAssets="All"/>
</ItemGroup> </ItemGroup>
<Target Name="PostBuild" BeforeTargets="PostBuildEvent" Condition="$(MSBuildProjectName.Contains('Addon.')) And !$(MSBuildProjectName.Contains('Test')) And !$(MSBuildProjectName.Contains('Demo')) And ($(OsProductName.Contains('Windows 10')) Or (!$(OsProductName.Contains('Windows 10')) And !$(MSBuildProjectName.Contains('Win10'))))"> <Target Name="PostBuild" BeforeTargets="PostBuildEvent" Condition="'$(BuildingInsideVisualStudio)' == 'true' And $(MSBuildProjectName.Contains('Addon.')) And !$(MSBuildProjectName.Contains('Test')) And !$(MSBuildProjectName.Contains('Demo')) And ($(OsProductName.Contains('Windows 10')) Or (!$(OsProductName.Contains('Windows 10')) And !$(MSBuildProjectName.Contains('Win10'))))">
<Exec Command=" <Exec Command="
xcopy /q /y /d &quot;$(TargetDir)$(TargetName).*&quot; &quot;$(SolutionDir)$(SolutionName)\$(OutDir)&quot;&#xD;&#xA; xcopy /q /y /d &quot;$(TargetDir)$(TargetName).*&quot; &quot;$(SolutionDir)$(SolutionName)\$(OutDir)&quot;&#xD;&#xA;
xcopy /q /y /d &quot;$(TargetDir)*.dll&quot; &quot;$(SolutionDir)$(SolutionName)\$(OutDir)&quot;&#xD;&#xA; xcopy /q /y /d &quot;$(TargetDir)*.dll&quot; &quot;$(SolutionDir)$(SolutionName)\$(OutDir)&quot;&#xD;&#xA;

View file

@ -34,6 +34,9 @@ using Greenshot.Addons.Animation;
using Greenshot.Addons.Controls; using Greenshot.Addons.Controls;
using Greenshot.Addons.Core; using Greenshot.Addons.Core;
using Greenshot.Gfx; using Greenshot.Gfx;
using Dapplo.Windows.User32;
using Dapplo.Windows.Dpi;
using System.Text;
namespace Greenshot.Forms namespace Greenshot.Forms
{ {
@ -354,7 +357,10 @@ namespace Greenshot.Forms
DialogResult = DialogResult.Cancel; DialogResult = DialogResult.Cancel;
break; break;
case Keys.E: case Keys.E:
MessageBox.Show(EnvironmentInfo.EnvironmentToString(true)); var info = new StringBuilder(EnvironmentInfo.EnvironmentToString(true));
var screenboundsSize = DisplayInfo.ScreenBounds.Size;
info.AppendFormat("Screen: {0} at {1}%", $"{screenboundsSize.Width} x {screenboundsSize.Height}", FormDpiHandler.ScaleWithCurrentDpi(100));
MessageBox.Show(info.ToString(), "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
break; break;
case Keys.L: case Keys.L:
// TODO: Open the log file // TODO: Open the log file

View file

@ -59,8 +59,7 @@ namespace Greenshot.Helpers
public static string EnvironmentToString(bool newline) public static string EnvironmentToString(bool newline)
{ {
var environment = new StringBuilder(); var environment = new StringBuilder("Software version: " + Application.ProductVersion);
environment.Append("Software version: " + Application.ProductVersion);
environment.Append(" (" + OsInfo.Bits + " bit)"); environment.Append(" (" + OsInfo.Bits + " bit)");
if (newline) if (newline)
@ -88,6 +87,16 @@ namespace Greenshot.Helpers
if (IsWindows) if (IsWindows)
{ {
if (newline)
{
environment.AppendLine();
}
else
{
environment.Append(", ");
}
environment.AppendFormat("OS: {0} {1} {2} (x{3}) {4}", OsInfo.Name, OsInfo.Edition, OsInfo.ServicePack, OsInfo.Bits, OsInfo.VersionString);
if (newline) if (newline)
{ {
environment.AppendLine(); environment.AppendLine();
@ -96,17 +105,19 @@ namespace Greenshot.Helpers
{ {
environment.Append(", "); environment.Append(", ");
} }
environment.Append(string.Format("OS: {0} {1} {2} (x{3}) {4}", OsInfo.Name, OsInfo.Edition, OsInfo.ServicePack, OsInfo.Bits, OsInfo.VersionString));
if (newline) environment.AppendFormat("Location: {0}", Assembly.GetEntryAssembly()?.Location);
{ if (newline)
environment.AppendLine(); {
} environment.AppendLine();
else }
{ else
environment.Append(", "); {
} environment.Append(", ");
// Get some important information for fixing GDI related Problems }
environment.AppendFormat("GDI object count: {0}", User32Api.GetGuiResourcesGdiCount());
// Get some important information for fixing GDI related Problems
environment.AppendFormat("GDI object count: {0}", User32Api.GetGuiResourcesGdiCount());
if (newline) if (newline)
{ {
environment.AppendLine(); environment.AppendLine();