pull/668/head
NextTurn 2018-12-01 00:00:00 +08:00 committed by Next Turn
parent 2fc786a26a
commit a7c5334f10
3 changed files with 21 additions and 6 deletions

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net471;netcoreapp5.0</TargetFrameworks> <TargetFrameworks>net471;net5.0</TargetFrameworks>
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
</PropertyGroup> </PropertyGroup>
@ -20,7 +20,7 @@
</PackageReference> </PackageReference>
</ItemGroup> </ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' != 'netcoreapp5.0'"> <ItemGroup Condition="'$(TargetFramework)' != 'net5.0'">
<PackageReference Include="System.Reflection.Metadata" Version="1.8.1" /> <PackageReference Include="System.Reflection.Metadata" Version="1.8.1" />
<Reference Include="System.ServiceProcess" /> <Reference Include="System.ServiceProcess" />
</ItemGroup> </ItemGroup>
@ -39,11 +39,11 @@
<Target Name="Copy" BeforeTargets="AfterBuild"> <Target Name="Copy" BeforeTargets="AfterBuild">
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp5.0'"> <ItemGroup Condition="'$(TargetFramework)' == 'net5.0'">
<_FilesToCopy Include="$(ArtifactsBinDir)WinSW\$(Configuration)\net5.0\WinSW.runtimeconfig*.json" /> <_FilesToCopy Include="$(ArtifactsBinDir)WinSW\$(Configuration)\net5.0\WinSW.runtimeconfig*.json" />
</ItemGroup> </ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' != 'netcoreapp5.0'"> <ItemGroup Condition="'$(TargetFramework)' != 'net5.0'">
<_FilesToCopy Include="$(ArtifactsBinDir)WinSW\$(Configuration)\net461\System.ValueTuple.dll" /> <_FilesToCopy Include="$(ArtifactsBinDir)WinSW\$(Configuration)\net461\System.ValueTuple.dll" />
</ItemGroup> </ItemGroup>

View File

@ -102,7 +102,15 @@ namespace WinSW
AutoRefresh(config); AutoRefresh(config);
ServiceBase.Run(new WrapperService(config)); using var service = new WrapperService(config);
try
{
ServiceBase.Run(service);
}
catch
{
// handled in OnStart
}
}), }),
}; };

View File

@ -586,7 +586,14 @@ namespace WinSW
if (this.config.Priority is ProcessPriorityClass priority) if (this.config.Priority is ProcessPriorityClass priority)
{ {
process.PriorityClass = priority; try
{
process.PriorityClass = priority;
}
catch (InvalidOperationException)
{
// exited
}
} }
if (logHandler != null) if (logHandler != null)