mirror of https://github.com/winsw/winsw
Add new target frameworks
parent
b9089ab748
commit
8864b676fb
|
@ -0,0 +1,7 @@
|
|||
<Project>
|
||||
|
||||
<PropertyGroup Condition="'$(TargetFramework)' == 'net45' or '$(TargetFramework)' == 'netcoreapp3.1'">
|
||||
<DefineConstants>VNEXT</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
14
appveyor.yml
14
appveyor.yml
|
@ -34,16 +34,20 @@ after_build:
|
|||
|
||||
test_script:
|
||||
# Runner for NUnit2
|
||||
- ps: nunit-console 'src/Test/winswTests/bin/Release/net40/winswTests.dll' 'src/Test/winswTests/bin/Release/net40/SharedDirectoryMapper.dll' 'src/Test/winswTests/bin/Release/net40/RunawayProcessKiller.dll'
|
||||
- ps: nunit-console 'src\Test\winswTests\bin\Release\net40\winswTests.dll' 'src\Test\winswTests\bin\Release\net40\SharedDirectoryMapper.dll' 'src\Test\winswTests\bin\Release\net40\RunawayProcessKiller.dll'
|
||||
|
||||
artifacts:
|
||||
- path: 'src/Core/ServiceWrapper/bin/Release/net20/WinSW.exe'
|
||||
- path: 'src\Core\ServiceWrapper\bin\Release\net20\WinSW.exe'
|
||||
name: WinSW.NET2.exe
|
||||
- path: 'src/Core/ServiceWrapper/bin/Release/net40/WinSW.exe'
|
||||
- path: 'src\Core\ServiceWrapper\bin\Release\net40\WinSW.exe'
|
||||
name: WinSW.NET4.exe
|
||||
- path: 'src\Core\ServiceWrapper\bin\Release\net45\WinSW.exe'
|
||||
name: WinSW.NET45.exe
|
||||
- path: 'src\Core\ServiceWrapper\bin\Release\netcoreapp3.1\'
|
||||
name: WinSW.NETCore
|
||||
- path: 'WinSW.$(appveyor_build_version).nupkg'
|
||||
name: WinSW.nupkg
|
||||
- path: 'examples/sample-allOptions.xml'
|
||||
- path: 'examples\sample-allOptions.xml'
|
||||
name: 'sample-allOptions.xml'
|
||||
- path: 'examples/sample-minimal.xml'
|
||||
- path: 'examples\sample-minimal.xml'
|
||||
name: 'sample-minimal.xml'
|
||||
|
|
|
@ -32,7 +32,11 @@ namespace winsw
|
|||
|
||||
internal WinSWExtensionManager ExtensionManager { get; private set; }
|
||||
|
||||
private static readonly ILog Log = LogManager.GetLogger("WinSW");
|
||||
private static readonly ILog Log = LogManager.GetLogger(
|
||||
#if NETCOREAPP
|
||||
Assembly.GetExecutingAssembly(),
|
||||
#endif
|
||||
"WinSW");
|
||||
private static readonly WrapperServiceEventLogProvider eventLogProvider = new WrapperServiceEventLogProvider();
|
||||
|
||||
/// <summary>
|
||||
|
@ -827,7 +831,11 @@ namespace winsw
|
|||
systemEventLogger.ActivateOptions();
|
||||
appenders.Add(systemEventLogger);
|
||||
|
||||
BasicConfigurator.Configure(appenders.ToArray());
|
||||
BasicConfigurator.Configure(
|
||||
#if NETCOREAPP
|
||||
LogManager.GetRepository(Assembly.GetExecutingAssembly()),
|
||||
#endif
|
||||
appenders.ToArray());
|
||||
}
|
||||
|
||||
private static string ReadPassword()
|
||||
|
|
|
@ -2,9 +2,8 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFrameworks>net20;net40</TargetFrameworks>
|
||||
<!-- AppVeyor -->
|
||||
<Version></Version>
|
||||
<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>
|
||||
|
@ -16,13 +15,27 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ICSharpCode.SharpZipLib.dll" Version="0.85.4.369" />
|
||||
<PackageReference Include="ilmerge" Version="3.0.29" />
|
||||
<PackageReference Include="log4net" Version="2.0.8" />
|
||||
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<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>
|
||||
|
@ -35,19 +48,6 @@
|
|||
<None Include="$(AssemblyOriginatorKeyFile)" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\WinSWCore\WinSWCore.csproj" />
|
||||
<ProjectReference Include="..\..\Plugins\RunawayProcessKiller\RunawayProcessKiller.csproj" />
|
||||
|
@ -55,20 +55,19 @@
|
|||
</ItemGroup>
|
||||
|
||||
<!-- Merge plugins and other DLLs into the executable -->
|
||||
<Choose>
|
||||
<When Condition="'$(TargetFramework)' == 'net20'">
|
||||
<PropertyGroup>
|
||||
<TargetPlatform>v2</TargetPlatform>
|
||||
</PropertyGroup>
|
||||
</When>
|
||||
<When Condition="'$(TargetFramework)' == 'net40'">
|
||||
<PropertyGroup>
|
||||
<TargetPlatform>v4</TargetPlatform>
|
||||
</PropertyGroup>
|
||||
</When>
|
||||
</Choose>
|
||||
<Target Name="Merge" BeforeTargets="AfterBuild" Condition="'$(TargetFramework)' != 'netcoreapp3.1'">
|
||||
|
||||
<Target Name="Merge" BeforeTargets="AfterBuild">
|
||||
<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>
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
using System.Collections;
|
||||
using System.Reflection;
|
||||
using System.Reflection.Emit;
|
||||
using System.Threading;
|
||||
|
||||
namespace DynamicProxy
|
||||
{
|
||||
|
@ -174,15 +173,18 @@ namespace DynamicProxy
|
|||
Type objType = typeof(object);
|
||||
Type handlerType = typeof(IProxyInvocationHandler);
|
||||
|
||||
AppDomain domain = Thread.GetDomain();
|
||||
AssemblyName assemblyName = new AssemblyName();
|
||||
assemblyName.Name = ASSEMBLY_NAME;
|
||||
assemblyName.Version = new Version(1, 0, 0, 0);
|
||||
|
||||
// create a new assembly for this proxy, one that isn't presisted on the file system
|
||||
AssemblyBuilder assemblyBuilder = domain.DefineDynamicAssembly(
|
||||
assemblyName, AssemblyBuilderAccess.Run);
|
||||
// assemblyName, AssemblyBuilderAccess.RunAndSave,"."); // to save it to the disk
|
||||
AssemblyBuilder assemblyBuilder =
|
||||
#if VNEXT
|
||||
AssemblyBuilder.DefineDynamicAssembly(
|
||||
#else
|
||||
AppDomain.CurrentDomain.DefineDynamicAssembly(
|
||||
#endif
|
||||
assemblyName, AssemblyBuilderAccess.Run);
|
||||
|
||||
// create a new module for this proxy
|
||||
ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule(MODULE_NAME);
|
||||
|
@ -206,7 +208,7 @@ namespace DynamicProxy
|
|||
ConstructorBuilder delegateConstructor = typeBuilder.DefineConstructor(
|
||||
MethodAttributes.Public, CallingConventions.Standard, new Type[] { handlerType });
|
||||
|
||||
#region( "Constructor IL Code" )
|
||||
#region( "Constructor IL Code" )
|
||||
ILGenerator constructorIL = delegateConstructor.GetILGenerator();
|
||||
|
||||
// Load "this"
|
||||
|
@ -221,7 +223,7 @@ namespace DynamicProxy
|
|||
constructorIL.Emit(OpCodes.Call, superConstructor);
|
||||
// Constructor return
|
||||
constructorIL.Emit(OpCodes.Ret);
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
// for every method that the interfaces define, build a corresponding
|
||||
// method in the dynamic type that calls the handlers invoke method.
|
||||
|
@ -270,7 +272,7 @@ namespace DynamicProxy
|
|||
CallingConventions.Standard,
|
||||
methodInfo.ReturnType, methodParameters);
|
||||
|
||||
#region( "Handler Method IL Code" )
|
||||
#region( "Handler Method IL Code" )
|
||||
ILGenerator methodIL = methodBuilder.GetILGenerator();
|
||||
|
||||
// load "this"
|
||||
|
@ -341,7 +343,7 @@ namespace DynamicProxy
|
|||
|
||||
// Return
|
||||
methodIL.Emit(OpCodes.Ret);
|
||||
#endregion
|
||||
#endregion
|
||||
}
|
||||
|
||||
// for (int i = 0; i < props.Length; i++)
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
#if VNEXT
|
||||
using System.IO.Compression;
|
||||
#endif
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
#if !VNEXT
|
||||
using ICSharpCode.SharpZipLib.Zip;
|
||||
#endif
|
||||
|
||||
namespace winsw
|
||||
{
|
||||
|
@ -522,9 +527,34 @@ namespace winsw
|
|||
}
|
||||
}
|
||||
|
||||
#if VNEXT
|
||||
private void ZipTheFile(string sourceFilePath, string zipDirectory, string zipFilePattern, string baseZipFileName)
|
||||
{
|
||||
string zipFilePath = Path.Combine(zipDirectory, $"{baseZipFileName}.{zipFilePattern}.zip");
|
||||
ZipArchive zipArchive = null;
|
||||
try
|
||||
{
|
||||
zipArchive = ZipFile.Open(zipFilePath, ZipArchiveMode.Update);
|
||||
|
||||
string fileName = Path.GetFileName(sourceFilePath);
|
||||
if (zipArchive.GetEntry(fileName) is null)
|
||||
{
|
||||
zipArchive.CreateEntryFromFile(sourceFilePath, fileName);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
EventLogger.LogEvent($"Failed to Zip the File {sourceFilePath}. Error {e.Message}");
|
||||
}
|
||||
finally
|
||||
{
|
||||
zipArchive?.Dispose();
|
||||
}
|
||||
}
|
||||
#else
|
||||
private void ZipTheFile(string filename, string zipPath, string zipFilePattern, string baseZipfilename)
|
||||
{
|
||||
var zipfilename = Path.Combine(zipPath, string.Format("{0}.{1}.zip", baseZipfilename, zipFilePattern));
|
||||
var zipfilename = Path.Combine(zipPath, $"{baseZipfilename}.{zipFilePattern}.zip");
|
||||
ZipFile zipFile = null;
|
||||
bool commited = false;
|
||||
try
|
||||
|
@ -559,10 +589,7 @@ namespace winsw
|
|||
}
|
||||
finally
|
||||
{
|
||||
if (zipFile != null)
|
||||
{
|
||||
zipFile.Close();
|
||||
}
|
||||
zipFile?.Close();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -575,6 +602,7 @@ namespace winsw
|
|||
throw new ApplicationException(em);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
private double SetupRollTimer()
|
||||
{
|
||||
|
|
|
@ -1,21 +1,32 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net20;net40</TargetFrameworks>
|
||||
<!-- AppVeyor -->
|
||||
<Version></Version>
|
||||
<TargetFrameworks>net20;net40;net45;netcoreapp3.1</TargetFrameworks>
|
||||
<Version><!-- Populated by AppVeyor --></Version>
|
||||
<RootNamespace>winsw</RootNamespace>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ICSharpCode.SharpZipLib.dll" Version="0.85.4.369" />
|
||||
<PackageReference Include="log4net" Version="2.0.8" />
|
||||
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
|
||||
<PackageReference Include="System.Diagnostics.EventLog" Version="4.7.0" />
|
||||
<PackageReference Include="System.Management" Version="4.7.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' != 'netcoreapp3.1'">
|
||||
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" />
|
||||
<Reference Include="System.Management" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net45'">
|
||||
<Reference Include="System.IO.Compression" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net20' or '$(TargetFramework)' == 'net40'">
|
||||
<PackageReference Include="SharpZipLib" Version="0.86.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net20;net40</TargetFrameworks>
|
||||
<!-- AppVeyor -->
|
||||
<Version></Version>
|
||||
<TargetFrameworks>net20;net40;net45;netcoreapp3.1</TargetFrameworks>
|
||||
<Version><!-- Populated by AppVeyor --></Version>
|
||||
<RootNamespace>winsw.Plugins.RunawayProcessKiller</RootNamespace>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="log4net" Version="2.0.8" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' != 'netcoreapp3.1'">
|
||||
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net20;net40</TargetFrameworks>
|
||||
<!-- AppVeyor -->
|
||||
<Version></Version>
|
||||
<TargetFrameworks>net20;net40;net45;netcoreapp3.1</TargetFrameworks>
|
||||
<Version><!-- Populated by AppVeyor --></Version>
|
||||
<RootNamespace>winsw.Plugins.SharedDirectoryMapper</RootNamespace>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="log4net" Version="2.0.8" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' != 'netcoreapp3.1'">
|
||||
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net20;net40</TargetFrameworks>
|
||||
<!-- AppVeyor -->
|
||||
<Version></Version>
|
||||
<TargetFrameworks>net20;net40;net45;netcoreapp3.1</TargetFrameworks>
|
||||
<Version><!-- Populated by AppVeyor --></Version>
|
||||
<RootNamespace>winswTests</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
|
@ -11,12 +10,12 @@
|
|||
<PackageReference Include="JetBrains.Annotations" Version="8.0.5.0" />
|
||||
<PackageReference Include="log4net" Version="2.0.8" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
|
||||
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" />
|
||||
<PackageReference Include="NUnit" Version="2.6.4" />
|
||||
<PackageReference Include="NUnitTestAdapter" Version="2.2.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ItemGroup Condition="'$(TargetFramework)' != 'netcoreapp3.1'">
|
||||
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" />
|
||||
<Reference Include="System.ServiceProcess" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
Loading…
Reference in New Issue