Skip to content

net5.0-windows #59

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,4 @@ packages/
.vscode
*.orig
MigrationBackup
/src/ExceptionReporter.WinForms/Properties/PublishProfiles/FolderProfile.pubxml
12 changes: 9 additions & 3 deletions src/ExceptionReporter.Shared/ReportGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

using System;
using System.Collections.Generic;
#if NETFRAMEWORK
using System.Deployment.Application;
#endif
using System.Reflection;
using ExceptionReporting.Core;
using ExceptionReporting.Report;
Expand Down Expand Up @@ -42,14 +44,18 @@ public ReportGenerator(ExceptionReportInfo reportInfo)
_info.AppName = _info.AppName.IsEmpty() ? _info.AppAssembly.GetName().Name: _info.AppName;
_info.AppVersion = _info.AppVersion.IsEmpty() ? GetAppVersion() : _info.AppVersion;
_info.ExceptionDate = _info.ExceptionDateKind != DateTimeKind.Local ? DateTime.UtcNow : DateTime.Now;
}
}

private string GetAppVersion()
{
return ApplicationDeployment.IsNetworkDeployed ?
#if NETFRAMEWORK
return ApplicationDeployment.IsNetworkDeployed ?
ApplicationDeployment.CurrentDeployment.CurrentVersion.ToString() : _info.AppAssembly.GetName().Version.ToString();
#else
return _info.AppAssembly.GetName().Version.ToString();
#endif
}

/// <summary>
/// Generate the exception report
/// </summary>
Expand Down
22 changes: 14 additions & 8 deletions src/ExceptionReporter.WinForms/ExceptionReporter.WinForms.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
<AssemblyName>ExceptionReporter.NET</AssemblyName>
<PackageId>ExceptionReporter</PackageId>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<TargetFrameworks>net40</TargetFrameworks>
<TargetFrameworks>net40;net5.0-windows</TargetFrameworks>
<UseWindowsForms>true</UseWindowsForms>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<ReleaseVersion>5.0</ReleaseVersion>
<PackageLicenseUrl></PackageLicenseUrl>
<PackageProjectUrl>https://github.com/PandaWood/ExceptionReporter.NET</PackageProjectUrl>
Expand All @@ -13,10 +15,18 @@
<EmbeddedResource Remove="Properties\Resources.en.resx" />
<EmbeddedResource Remove="Properties\Resources.ru.resx" />
</ItemGroup>
<ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net40' ">
<Reference Include="System.Deployment" />
<PackageReference Include="Simple-MAPI.NET" Version="1.2.0" />
<PackageReference Include="DotNetZip" Version="1.15.0" />
<PackageReference Include="Handlebars.Net" Version="1.9.0" />
<PackageReference Include="Simple-MAPI.NET" Version="1.2.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net5.0-windows' ">
<PackageReference Include="Simple-MAPI.NET" Version="1.2.1" />
<PackageReference Include="DotNetZip" Version="1.15.0" />
<PackageReference Include="Handlebars.Net" Version="2.0.10" />
<PackageReference Include="System.Management" Version="6.0.0" />
<PackageReference Include="System.Resources.Extensions" Version="6.0.0" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Properties\Resources.en.resx">
Expand All @@ -29,14 +39,10 @@
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Reference Include="System.Configuration" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Management" />
<Reference Include="System.Windows.Forms" />
</ItemGroup>
<PropertyGroup>
<Version>5.0</Version>
<Version>5.0.1</Version>
<FileVersion>5.0.0.0</FileVersion>
<Authors>Peter van der Woude, Simon Cropp</Authors>
<Description>ExceptionReporter is a .NET UserControl/Dialog that gathers detailed information on an Exception and the application/system running it. It allows the user to copy, save or email a report to the developer</Description>
Expand Down
2 changes: 1 addition & 1 deletion src/Tests/AssemblyDigger_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public void Can_Dig_Assembly_Refs_By_Name()
var digger = new AssemblyDigger(Assembly.Load("ExceptionReporter.NET"));
var refs = digger.GetAssemblyRefs().ToList();

Assert.That(refs.Select(r => r.Name), Is.SupersetOf(new [] {"System.Core", "DotNetZip", "SimpleMapi.NET"}));
Assert.That(refs.Select(r => r.Name), Is.SupersetOf(new [] {"DotNetZip", "SimpleMapi.NET", "Handlebars" }));
}

[Test]
Expand Down
4 changes: 4 additions & 0 deletions src/Tests/ReportBuilder_Tests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
using System.Collections.Generic;
using System.Linq;
#if !NETCOREAPP
using AutoMoq;
#else
using AutoMoqCore;
#endif
using ExceptionReporting;
using ExceptionReporting.Report;
using ExceptionReporting.SystemInfo;
Expand Down
27 changes: 17 additions & 10 deletions src/Tests/Tests.ExceptionReporter.NET.csproj
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<TargetFrameworks>net472;net5.0-windows</TargetFrameworks>
<RootNamespace>Tests.ExceptionReporting</RootNamespace>
<ReleaseVersion>4.0.3</ReleaseVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AutoMoq" Version="2.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0" />
<PackageReference Include="Moq" Version="4.16.1" />
<PackageReference Include="NUnit" Version="3.13.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.0.0" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net472' ">
<PackageReference Include="AutoMoq" Version="2.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="Moq" Version="4.16.1" />
<PackageReference Include="NUnit" Version="3.13.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.1.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net5.0-windows' ">
<PackageReference Include="System.Management" Version="6.0.0" />
<PackageReference Include="AutoMoqCore" Version="2.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="Moq" Version="4.16.1" />
<PackageReference Include="NUnit" Version="3.13.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.1.0" />
</ItemGroup>
<ItemGroup>
<None Remove="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ExceptionReporter.WinForms\ExceptionReporter.WinForms.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="System.Deployment" />
<Reference Include="System.Management" />
</ItemGroup>
<ItemGroup>
Expand Down