Publish single executable

pull/354/head
NextTurn 2018-12-05 00:00:00 +08:00
parent 492a4e3e42
commit cf396b718b
No known key found for this signature in database
GPG Key ID: 17A0D50ADDE1A0C4
3 changed files with 103 additions and 97 deletions

View File

@ -27,7 +27,9 @@ dotnet_csproj:
version: $(appveyor_build_version)
build_script:
- dotnet.exe build src\winsw.sln
- dotnet.exe build src\winsw.sln
- dotnet.exe publish -f netcoreapp3.1 -r win-x64 src\Core\ServiceWrapper\winsw.csproj /p:PublishSingleFile=true /p:PublishTrimmed=true
- dotnet.exe publish -f netcoreapp3.1 -r win-x86 src\Core\ServiceWrapper\winsw.csproj /p:PublishSingleFile=true /p:PublishTrimmed=true
after_build:
- ps: nuget pack WinSW.nuspec -Version $env:APPVEYOR_BUILD_VERSION
@ -46,6 +48,10 @@ artifacts:
name: WinSW.NET45.exe
- path: 'src\Core\ServiceWrapper\bin\Release\netcoreapp3.1\'
name: WinSW.NETCore31
- path: 'src\Core\ServiceWrapper\bin\Release\netcoreapp3.1\win-x64\publish\WindowsService.exe'
name: WinSW.NETCore31.x64
- path: 'src\Core\ServiceWrapper\bin\Release\netcoreapp3.1\win-x86\publish\WindowsService.exe'
name: WinSW.NETCore31.x86
- path: 'WinSW.$(appveyor_build_version).nupkg'
name: WinSW.nupkg
- path: 'examples\sample-allOptions.xml'

View File

@ -1,96 +1,86 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net20;net40;net45;netcoreapp3.1</TargetFrameworks>
<Version><!-- Populated by AppVeyor --></Version>
<AssemblyTitle>Windows Service Wrapper</AssemblyTitle>
<Description>Allows arbitrary process to run as a Windows service by wrapping it.</Description>
<Company>CloudBees, Inc.</Company>
<Product>Windows Service Wrapper</Product>
<Copyright>Copyright 2008-2016 Oleg Nenashev, CloudBees, Inc. and other contributors</Copyright>
<RootNamespace>winsw</RootNamespace>
<AssemblyName>WindowsService</AssemblyName>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="log4net" Version="2.0.8" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
<PackageReference Include="Microsoft.Win32.Registry" Version="4.7.0" />
<PackageReference Include="System.ServiceProcess.ServiceController" Version="4.7.0" />
</ItemGroup>
<!-- error NU1605: Detected package downgrade: log4net 2.0.8 -->
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
<PackageReference Include="System.Diagnostics.Debug" Version="4.3.0" />
<PackageReference Include="System.IO.FileSystem" Version="4.3.0" />
<PackageReference Include="System.Net.NameResolution" Version="4.3.0" />
<PackageReference Include="System.Runtime.Extensions" Version="4.3.1" />
<PackageReference Include="System.Runtime.InteropServices" Version="4.3.0" />
<PackageReference Include="System.Threading" Version="4.3.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' != 'netcoreapp3.1'">
<PackageReference Include="ilmerge" Version="3.0.29" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" />
<Reference Include="System.Management" />
<Reference Include="System.ServiceProcess" />
</ItemGroup>
<ItemGroup>
<Content Include="manifest.xml" />
</ItemGroup>
<ItemGroup>
<None Include="$(AssemblyOriginatorKeyFile)" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\WinSWCore\WinSWCore.csproj" />
<ProjectReference Include="..\..\Plugins\RunawayProcessKiller\RunawayProcessKiller.csproj" />
<ProjectReference Include="..\..\Plugins\SharedDirectoryMapper\SharedDirectoryMapper.csproj" />
</ItemGroup>
<!-- Merge plugins and other DLLs into the executable -->
<Target Name="Merge" BeforeTargets="AfterBuild" Condition="'$(TargetFramework)' != 'netcoreapp3.1'">
<PropertyGroup Condition="'$(TargetFramework)' == 'net20'">
<TargetPlatform>v2</TargetPlatform>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net40'">
<TargetPlatform>v4</TargetPlatform>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net45'">
<TargetPlatform>v4.5</TargetPlatform>
</PropertyGroup>
<PropertyGroup>
<InputAssemblies>"$(OutDir)$(TargetFileName)"</InputAssemblies>
<InputAssemblies>$(InputAssemblies) "$(OutDir)WinSWCore.dll"</InputAssemblies>
<InputAssemblies>$(InputAssemblies) "$(OutDir)SharedDirectoryMapper.dll"</InputAssemblies>
<InputAssemblies>$(InputAssemblies) "$(OutDir)RunawayProcessKiller.dll"</InputAssemblies>
<InputAssemblies>$(InputAssemblies) "$(OutDir)log4net.dll"</InputAssemblies>
<OutputAssembly>"$(OutDir)WinSW.exe"</OutputAssembly>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net20' or '$(TargetFramework)' == 'net40'">
<InputAssemblies>$(InputAssemblies) "$(OutDir)ICSharpCode.SharpZipLib.dll"</InputAssemblies>
</PropertyGroup>
<PropertyGroup>
<ILMerge>$(NuGetPackageRoot)ilmerge\3.0.29\tools\net452\ILMerge.exe</ILMerge>
<ILMergeArgs>/keyfile:"$(AssemblyOriginatorKeyFile)" /targetplatform:$(TargetPlatform) /out:$(OutputAssembly) $(InputAssemblies)</ILMergeArgs>
<ILMergeCommand>"$(ILMerge)" $(ILMergeArgs)</ILMergeCommand>
</PropertyGroup>
<Message Text="$(ILMergeCommand)" Importance="high" />
<Exec Command="$(ILMergeCommand)" />
</Target>
</Project>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net20;net40;net45;netcoreapp3.1</TargetFrameworks>
<Version><!-- Populated by AppVeyor --></Version>
<AssemblyTitle>Windows Service Wrapper</AssemblyTitle>
<Description>Allows arbitrary process to run as a Windows service by wrapping it.</Description>
<Company>CloudBees, Inc.</Company>
<Product>Windows Service Wrapper</Product>
<Copyright>Copyright 2008-2016 Oleg Nenashev, CloudBees, Inc. and other contributors</Copyright>
<RootNamespace>winsw</RootNamespace>
<AssemblyName>WindowsService</AssemblyName>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="log4net" Version="2.0.8" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
<PackageReference Include="Microsoft.Win32.Registry" Version="4.7.0" />
<PackageReference Include="System.ServiceProcess.ServiceController" Version="4.7.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' != 'netcoreapp3.1'">
<PackageReference Include="ilmerge" Version="3.0.29" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" />
<Reference Include="System.Management" />
<Reference Include="System.ServiceProcess" />
</ItemGroup>
<ItemGroup>
<Content Include="manifest.xml" />
</ItemGroup>
<ItemGroup>
<None Include="$(AssemblyOriginatorKeyFile)" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\WinSWCore\WinSWCore.csproj" />
<ProjectReference Include="..\..\Plugins\RunawayProcessKiller\RunawayProcessKiller.csproj" />
<ProjectReference Include="..\..\Plugins\SharedDirectoryMapper\SharedDirectoryMapper.csproj" />
</ItemGroup>
<!-- Merge plugins and other DLLs into the executable -->
<Target Name="Merge" BeforeTargets="AfterBuild" Condition="'$(TargetFramework)' != 'netcoreapp3.1'">
<PropertyGroup Condition="'$(TargetFramework)' == 'net20'">
<TargetPlatform>v2</TargetPlatform>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net40'">
<TargetPlatform>v4</TargetPlatform>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net45'">
<TargetPlatform>v4.5</TargetPlatform>
</PropertyGroup>
<PropertyGroup>
<InputAssemblies>"$(OutDir)$(TargetFileName)"</InputAssemblies>
<InputAssemblies>$(InputAssemblies) "$(OutDir)WinSWCore.dll"</InputAssemblies>
<InputAssemblies>$(InputAssemblies) "$(OutDir)SharedDirectoryMapper.dll"</InputAssemblies>
<InputAssemblies>$(InputAssemblies) "$(OutDir)RunawayProcessKiller.dll"</InputAssemblies>
<InputAssemblies>$(InputAssemblies) "$(OutDir)log4net.dll"</InputAssemblies>
<OutputAssembly>"$(OutDir)WinSW.exe"</OutputAssembly>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net20' or '$(TargetFramework)' == 'net40'">
<InputAssemblies>$(InputAssemblies) "$(OutDir)ICSharpCode.SharpZipLib.dll"</InputAssemblies>
</PropertyGroup>
<PropertyGroup>
<ILMerge>$(NuGetPackageRoot)ilmerge\3.0.29\tools\net452\ILMerge.exe</ILMerge>
<ILMergeArgs>/keyfile:"$(AssemblyOriginatorKeyFile)" /targetplatform:$(TargetPlatform) /out:$(OutputAssembly) $(InputAssemblies)</ILMergeArgs>
<ILMergeCommand>"$(ILMerge)" $(ILMergeArgs)</ILMergeCommand>
</PropertyGroup>
<Message Text="$(ILMergeCommand)" Importance="high" />
<Exec Command="$(ILMergeCommand)" />
</Target>
</Project>

View File

@ -16,6 +16,16 @@
<PackageReference Include="System.Management" Version="4.7.0" />
</ItemGroup>
<!-- error NU1605: Detected package downgrade: log4net 2.0.8 -->
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
<PackageReference Include="System.Diagnostics.Debug" Version="4.3.0" />
<PackageReference Include="System.IO.FileSystem" Version="4.3.0" />
<PackageReference Include="System.Net.NameResolution" Version="4.3.0" />
<PackageReference Include="System.Runtime.Extensions" Version="4.3.1" />
<PackageReference Include="System.Runtime.InteropServices" Version="4.3.0" />
<PackageReference Include="System.Threading" Version="4.3.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' != 'netcoreapp3.1'">
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" />
<Reference Include="System.Management" />