mirror of https://github.com/winsw/winsw
Upgrade build flows (#729)
parent
f4dcdfc73e
commit
820f46e6bf
|
@ -4,6 +4,14 @@
|
|||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<DebugType>full</DebugType>
|
||||
<ArtifactsDir>$(MSBuildThisFileDirectory)artifacts\</ArtifactsDir>
|
||||
<ArtifactsBinDir>$(ArtifactsDir)bin\</ArtifactsBinDir>
|
||||
<ArtifactsObjDir>$(ArtifactsDir)obj\</ArtifactsObjDir>
|
||||
<ArtifactsPublishDir>$(ArtifactsDir)publish\</ArtifactsPublishDir>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<BaseOutputPath>$(ArtifactsBinDir)$(MSBuildProjectName)\</BaseOutputPath>
|
||||
<BaseIntermediateOutputPath>$(ArtifactsObjDir)$(MSBuildProjectName)\</BaseIntermediateOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<Project>
|
||||
|
||||
<PropertyGroup Condition="'$(TargetFramework)' == 'net461' or '$(TargetFramework)' == 'netcoreapp3.1'">
|
||||
<PropertyGroup Condition="'$(TargetFramework)' == 'net461' or '$(TargetFramework)' == 'net5.0-windows'">
|
||||
<DefineConstants>VNEXT</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Kohsuke Kawaguchi, Sun Microsystems, Inc., CloudBees, Inc., Oleg Nenashev and other contributors
|
||||
Copyright (c) 2008-2020 Kohsuke Kawaguchi, Sun Microsystems, Inc., CloudBees, Inc., Oleg Nenashev and other contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
|
@ -17,7 +17,7 @@ More info about the wrapper is available in the projects GitHub repository.
|
|||
<license type="expression">MIT</license>
|
||||
<projectUrl>https://github.com/winsw/winsw</projectUrl>
|
||||
<!--<iconUrl>TODO</iconUrl>-->
|
||||
<copyright>Copyright (c) 2010-2016 Kohsuke Kawaguchi, Sun Microsystems, Inc., CloudBees, Inc., Oleg Nenashev and other contributors</copyright>
|
||||
<copyright>Copyright (c) 2008-2020 Kohsuke Kawaguchi, Sun Microsystems, Inc., CloudBees, Inc., Oleg Nenashev and other contributors</copyright>
|
||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||
<tags>service wrapper</tags>
|
||||
<dependencies>
|
||||
|
@ -25,9 +25,9 @@ More info about the wrapper is available in the projects GitHub repository.
|
|||
</dependencies>
|
||||
</metadata>
|
||||
<files>
|
||||
<file src="artifacts\WinSW.NET2.exe" target="lib\net20-full\WinSW.NET2.exe" />
|
||||
<file src="artifacts\WinSW.NET4.exe" target="lib\net40-full\WinSW.NET4.exe" />
|
||||
<file src="artifacts\WinSW.NET461.exe" target="lib\net461-full\WinSW.NET461.exe" />
|
||||
<file src="artifacts\publish\WinSW.NET2.exe" target="lib\net20-full\WinSW.NET2.exe" />
|
||||
<file src="artifacts\publish\WinSW.NET4.exe" target="lib\net40-full\WinSW.NET4.exe" />
|
||||
<file src="artifacts\publish\WinSW.NET461.exe" target="lib\net461-full\WinSW.NET461.exe" />
|
||||
<file src="examples\sample-allOptions.xml" target="lib\net20-full\WinSW.NET2.xml" />
|
||||
<file src="examples\sample-allOptions.xml" target="lib\net40-full\WinSW.NET4.xml" />
|
||||
<file src="examples\sample-allOptions.xml" target="lib\net461-full\WinSW.NET461.xml" />
|
||||
|
|
|
@ -28,11 +28,18 @@ jobs:
|
|||
Release:
|
||||
BuildConfiguration: Release
|
||||
steps:
|
||||
- script: |
|
||||
dotnet build -c $(BuildConfiguration) src\WinSW.sln -p:Version=$(BuildVersion)
|
||||
dotnet publish -c $(BuildConfiguration) -f netcoreapp3.1 -r win-x64 src\WinSW\WinSW.csproj -p:PublishSingleFile=true -p:PublishTrimmed=true -p:Version=$(BuildVersion)
|
||||
dotnet publish -c $(BuildConfiguration) -f netcoreapp3.1 -r win-x86 src\WinSW\WinSW.csproj -p:PublishSingleFile=true -p:PublishTrimmed=true -p:Version=$(BuildVersion)
|
||||
- task: DotNetCoreCLI@2
|
||||
displayName: Build
|
||||
inputs:
|
||||
command: build
|
||||
projects: src\WinSW.sln
|
||||
arguments: -c $(BuildConfiguration) -p:Version=$(BuildVersion)
|
||||
- script: |
|
||||
dotnet publish -c $(BuildConfiguration) -f net5.0-windows -r win-x64 src\WinSW\WinSW.csproj -p:PublishSingleFile=true -p:PublishTrimmed=true -p:Version=$(BuildVersion)
|
||||
dotnet publish -c $(BuildConfiguration) -f net5.0-windows -r win-x86 src\WinSW\WinSW.csproj -p:PublishSingleFile=true -p:PublishTrimmed=true -p:Version=$(BuildVersion)
|
||||
displayName: Build
|
||||
- script: dotnet test -c $(BuildConfiguration) --collect "XPlat Code Coverage" --no-build src\WinSW.Tests\WinSW.Tests.csproj
|
||||
displayName: Test
|
||||
- task: NuGetToolInstaller@1
|
||||
displayName: Install Nuget
|
||||
inputs:
|
||||
|
@ -44,51 +51,41 @@ jobs:
|
|||
packagesToPack: WinSW.nuspec
|
||||
versioningScheme: byEnvVar
|
||||
versionEnvVar: BuildVersion
|
||||
- script: dotnet test -c $(BuildConfiguration) --collect "XPlat Code Coverage" --no-build src\WinSW.Tests\WinSW.Tests.csproj
|
||||
displayName: Test
|
||||
- script: dotnet tool restore
|
||||
displayName: Restore tools
|
||||
- script: dotnet tool run codecov -- -f "src\**\TestResults\*\coverage.cobertura.xml" --required
|
||||
displayName: Upload code coverage reports
|
||||
- task: PublishBuildArtifacts@1
|
||||
|
||||
- publish: artifacts\publish\WinSW.NET2.exe
|
||||
artifact: WinSW.NET2.exe_$(BuildConfiguration)
|
||||
displayName: Publish .NET 2.0
|
||||
inputs:
|
||||
PathtoPublish: artifacts\WinSW.NET2.exe
|
||||
ArtifactName: WinSW.NET2.exe_$(BuildConfiguration)
|
||||
- task: PublishBuildArtifacts@1
|
||||
|
||||
- publish: artifacts\publish\WinSW.NET4.exe
|
||||
artifact: WinSW.NET4.exe_$(BuildConfiguration)
|
||||
displayName: Publish .NET 4.0
|
||||
inputs:
|
||||
PathtoPublish: artifacts\WinSW.NET4.exe
|
||||
ArtifactName: WinSW.NET4.exe_$(BuildConfiguration)
|
||||
- task: PublishBuildArtifacts@1
|
||||
|
||||
- publish: artifacts\publish\WinSW.NET461.exe
|
||||
artifact: WinSW.NET461.exe_$(BuildConfiguration)
|
||||
displayName: Publish .NET 4.6.1
|
||||
inputs:
|
||||
PathtoPublish: artifacts\WinSW.NET461.exe
|
||||
ArtifactName: WinSW.NET461.exe_$(BuildConfiguration)
|
||||
- task: PublishBuildArtifacts@1
|
||||
displayName: Publish .NET Core 3.1 x64
|
||||
inputs:
|
||||
PathtoPublish: artifacts\WinSW.NETCore31.x64.exe
|
||||
ArtifactName: WinSW.NETCore31.x64.exe_$(BuildConfiguration)
|
||||
- task: PublishBuildArtifacts@1
|
||||
displayName: Publish .NET Core 3.1 x86
|
||||
inputs:
|
||||
PathtoPublish: artifacts\WinSW.NETCore31.x86.exe
|
||||
ArtifactName: WinSW.NETCore31.x86.exe_$(BuildConfiguration)
|
||||
- task: PublishBuildArtifacts@1
|
||||
|
||||
- publish: artifacts\publish\WinSW-x64.exe
|
||||
artifact: WinSW-x64.exe_$(BuildConfiguration)
|
||||
displayName: Publish .NET Core x64
|
||||
|
||||
- publish: artifacts\publish\WinSW-x86.exe
|
||||
artifact: WinSW-x86.exe_$(BuildConfiguration)
|
||||
displayName: Publish .NET Core x86
|
||||
|
||||
- publish: $(Build.ArtifactStagingDirectory)\WinSW.$(BuildVersion).nupkg
|
||||
artifact: WinSW.nupkg_$(BuildConfiguration)
|
||||
displayName: Publish Nuget
|
||||
inputs:
|
||||
PathtoPublish: $(Build.ArtifactStagingDirectory)\WinSW.$(BuildVersion).nupkg
|
||||
ArtifactName: WinSW.nupkg_$(BuildConfiguration)
|
||||
- task: PublishBuildArtifacts@1
|
||||
|
||||
- publish: examples\sample-allOptions.xml
|
||||
artifact: sample-allOptions.xml
|
||||
displayName: Publish full sample
|
||||
condition: and(succeeded(), eq(variables['BuildConfiguration'], 'Release'))
|
||||
inputs:
|
||||
PathtoPublish: examples\sample-allOptions.xml
|
||||
ArtifactName: sample-allOptions.xml
|
||||
- task: PublishBuildArtifacts@1
|
||||
|
||||
- publish: examples\sample-minimal.xml
|
||||
artifact: sample-minimal.xml
|
||||
displayName: Publish minimal sample
|
||||
condition: and(succeeded(), eq(variables['BuildConfiguration'], 'Release'))
|
||||
inputs:
|
||||
PathtoPublish: examples\sample-minimal.xml
|
||||
ArtifactName: sample-minimal.xml
|
||||
|
|
|
@ -1,20 +1,26 @@
|
|||
<!--
|
||||
Copyright (c) 2016 Oleg Nenashev and other contributors
|
||||
MIT License
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
software and associated documentation files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
Copyright (c) 2008-2020 Kohsuke Kawaguchi, Sun Microsystems, Inc., CloudBees,
|
||||
Inc., Oleg Nenashev and other contributors
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or
|
||||
substantial portions of the Software.
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
|
||||
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
-->
|
||||
|
||||
<!--
|
||||
|
|
|
@ -1,20 +1,26 @@
|
|||
<!--
|
||||
Copyright (c) 2016 Oleg Nenashev and other contributors
|
||||
MIT License
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
software and associated documentation files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
Copyright (c) 2008-2020 Kohsuke Kawaguchi, Sun Microsystems, Inc., CloudBees,
|
||||
Inc., Oleg Nenashev and other contributors
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or
|
||||
substantial portions of the Software.
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
|
||||
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
-->
|
||||
|
||||
<!--
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace WinSW.Configuration
|
|||
|
||||
public bool HideWindow => false;
|
||||
|
||||
public string ExecutablePath => Process.GetCurrentProcess().MainModule.FileName;
|
||||
public string ExecutablePath => Process.GetCurrentProcess().MainModule!.FileName!;
|
||||
|
||||
// Installation
|
||||
public Native.SC_ACTION[] FailureActions => new Native.SC_ACTION[0];
|
||||
|
@ -155,7 +155,7 @@ namespace WinSW.Configuration
|
|||
{
|
||||
get
|
||||
{
|
||||
var d = new DirectoryInfo(Path.GetDirectoryName(this.ExecutablePath));
|
||||
var d = new DirectoryInfo(Path.GetDirectoryName(this.ExecutablePath)!);
|
||||
return Path.Combine(d.FullName, this.BaseName);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -226,7 +226,7 @@ namespace WinSW
|
|||
}
|
||||
catch (WebException e)
|
||||
{
|
||||
if (supportsIfModifiedSince && ((HttpWebResponse)e.Response).StatusCode == HttpStatusCode.NotModified)
|
||||
if (supportsIfModifiedSince && ((HttpWebResponse?)e.Response)?.StatusCode == HttpStatusCode.NotModified)
|
||||
{
|
||||
Logger.Info($"Skipped downloading unmodified resource '{this.From}'");
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace WinSW.Extensions
|
|||
catch (ExtensionException ex)
|
||||
{
|
||||
Log.Fatal("onWrapperStarted() handler failed for " + ext.Value.DisplayName, ex);
|
||||
throw ex; // Propagate error to stop the startup
|
||||
throw; // Propagate error to stop the startup
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -222,7 +222,7 @@ namespace WinSW
|
|||
List<string> result = new List<string>(extensions.Count);
|
||||
for (int i = 0; i < extensions.Count; i++)
|
||||
{
|
||||
result.Add(XmlHelper.SingleAttribute<string>((XmlElement)extensions[i], "id"));
|
||||
result.Add(XmlHelper.SingleAttribute<string>((XmlElement)extensions[i]!, "id"));
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -245,12 +245,12 @@ namespace WinSW
|
|||
|
||||
StringBuilder arguments = new StringBuilder();
|
||||
|
||||
XmlNodeList argumentNodeList = this.dom.SelectNodes("//" + tagName);
|
||||
XmlNodeList argumentNodeList = this.dom.SelectNodes("//" + tagName)!;
|
||||
for (int i = 0; i < argumentNodeList.Count; i++)
|
||||
{
|
||||
arguments.Append(' ');
|
||||
|
||||
string token = Environment.ExpandEnvironmentVariables(argumentNodeList[i].InnerText);
|
||||
string token = Environment.ExpandEnvironmentVariables(argumentNodeList[i]!.InnerText);
|
||||
|
||||
if (token.StartsWith("\"") && token.EndsWith("\""))
|
||||
{
|
||||
|
@ -463,7 +463,7 @@ namespace WinSW
|
|||
string[] serviceDependencies = new string[nodeList.Count];
|
||||
for (int i = 0; i < nodeList.Count; i++)
|
||||
{
|
||||
serviceDependencies[i] = nodeList[i].InnerText;
|
||||
serviceDependencies[i] = nodeList[i]!.InnerText;
|
||||
}
|
||||
|
||||
return serviceDependencies;
|
||||
|
@ -582,8 +582,8 @@ namespace WinSW
|
|||
SC_ACTION[] result = new SC_ACTION[childNodes.Count];
|
||||
for (int i = 0; i < childNodes.Count; i++)
|
||||
{
|
||||
XmlNode node = childNodes[i];
|
||||
string action = node.Attributes["action"].Value;
|
||||
XmlNode node = childNodes[i]!;
|
||||
string action = node.Attributes!["action"]?.Value ?? throw new InvalidDataException("'action' is missing");
|
||||
SC_ACTION_TYPE type = action switch
|
||||
{
|
||||
"restart" => SC_ACTION_TYPE.SC_ACTION_RESTART,
|
||||
|
@ -689,13 +689,13 @@ namespace WinSW
|
|||
|
||||
private Dictionary<string, string> LoadEnvironmentVariables()
|
||||
{
|
||||
XmlNodeList nodeList = this.dom.SelectNodes("//env");
|
||||
XmlNodeList nodeList = this.dom.SelectNodes("//env")!;
|
||||
Dictionary<string, string> environment = new Dictionary<string, string>(nodeList.Count);
|
||||
for (int i = 0; i < nodeList.Count; i++)
|
||||
{
|
||||
XmlNode node = nodeList[i];
|
||||
string key = node.Attributes["name"].Value;
|
||||
string value = Environment.ExpandEnvironmentVariables(node.Attributes["value"].Value);
|
||||
XmlNode node = nodeList[i]!;
|
||||
string key = node.Attributes!["name"]?.Value ?? throw new InvalidDataException("'name' is missing");
|
||||
string value = Environment.ExpandEnvironmentVariables(node.Attributes["value"]?.Value ?? throw new InvalidDataException("'value' is missing"));
|
||||
environment[key] = value;
|
||||
|
||||
Environment.SetEnvironmentVariable(key, value);
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace WinSW.Util
|
|||
{
|
||||
public static void MoveOrReplaceFile(string sourceFileName, string destFileName)
|
||||
{
|
||||
#if NETCOREAPP
|
||||
#if NET
|
||||
File.Move(sourceFileName, destFileName, true);
|
||||
#else
|
||||
string sourceFilePath = Path.GetFullPath(sourceFileName);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net20;net40;net461;netcoreapp3.1</TargetFrameworks>
|
||||
<TargetFrameworks>net20;net40;net461;net5.0-windows</TargetFrameworks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
|
@ -18,14 +18,14 @@
|
|||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net5.0-windows'">
|
||||
<PackageReference Include="System.Diagnostics.EventLog" Version="4.7.0" />
|
||||
<PackageReference Include="System.Management" Version="4.7.0" />
|
||||
<PackageReference Include="System.Security.AccessControl" Version="4.7.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- error NU1605: Detected package downgrade: log4net 2.0.8 -->
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net5.0-windows'">
|
||||
<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" />
|
||||
|
@ -34,7 +34,7 @@
|
|||
<PackageReference Include="System.Threading" Version="4.3.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' != 'netcoreapp3.1'">
|
||||
<ItemGroup Condition="'$(TargetFramework)' != 'net5.0-windows'">
|
||||
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" />
|
||||
<Reference Include="System.Management" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net20;net40;net461;netcoreapp3.1</TargetFrameworks>
|
||||
<TargetFrameworks>net20;net40;net461;net5.0-windows</TargetFrameworks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' != 'netcoreapp3.1'">
|
||||
<ItemGroup Condition="'$(TargetFramework)' != 'net5.0-windows'">
|
||||
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net40;net461;netcoreapp3.1</TargetFrameworks>
|
||||
<TargetFrameworks>net40;net461;net5.0-windows</TargetFrameworks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
|||
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' != 'netcoreapp3.1'">
|
||||
<ItemGroup Condition="'$(TargetFramework)' != 'net5.0-windows'">
|
||||
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" />
|
||||
<Reference Include="System.ServiceProcess" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -4,7 +4,7 @@ using System.ComponentModel;
|
|||
using System.Diagnostics;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
#if NETCOREAPP
|
||||
#if NET
|
||||
using System.Reflection;
|
||||
#endif
|
||||
using System.Runtime.InteropServices;
|
||||
|
@ -512,8 +512,8 @@ namespace WinSW
|
|||
{
|
||||
UseShellExecute = true,
|
||||
Verb = "runas",
|
||||
FileName = current.MainModule.FileName,
|
||||
#if NETCOREAPP
|
||||
FileName = current.MainModule!.FileName!,
|
||||
#if NET
|
||||
Arguments = "/elevated " + string.Join(' ', args),
|
||||
#elif !NET20
|
||||
Arguments = "/elevated " + string.Join(" ", args),
|
||||
|
@ -525,7 +525,7 @@ namespace WinSW
|
|||
|
||||
try
|
||||
{
|
||||
using Process elevated = Process.Start(startInfo);
|
||||
using Process elevated = Process.Start(startInfo)!;
|
||||
|
||||
elevated.WaitForExit();
|
||||
Environment.Exit(elevated.ExitCode);
|
||||
|
@ -596,7 +596,7 @@ namespace WinSW
|
|||
appenders.Add(systemEventLogger);
|
||||
|
||||
BasicConfigurator.Configure(
|
||||
#if NETCOREAPP
|
||||
#if NET
|
||||
LogManager.GetRepository(Assembly.GetExecutingAssembly()),
|
||||
#endif
|
||||
appenders.ToArray());
|
||||
|
@ -664,7 +664,7 @@ namespace WinSW
|
|||
var executablePath = new DefaultWinSWSettings().ExecutablePath;
|
||||
var baseName = Path.GetFileNameWithoutExtension(executablePath);
|
||||
|
||||
var d = new DirectoryInfo(Path.GetDirectoryName(executablePath));
|
||||
var d = new DirectoryInfo(Path.GetDirectoryName(executablePath)!);
|
||||
|
||||
if (File.Exists(Path.Combine(d.FullName, baseName + ".xml")))
|
||||
{
|
||||
|
|
|
@ -2,27 +2,34 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFrameworks>net20;net40;net461;netcoreapp3.1</TargetFrameworks>
|
||||
<TargetFrameworks>net20;net40;net461;net5.0-windows</TargetFrameworks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<PublishTrimmed>true</PublishTrimmed>
|
||||
<TrimMode>Link</TrimMode>
|
||||
|
||||
<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>
|
||||
<Copyright>Copyright (c) 2008-2020 Kohsuke Kawaguchi, Sun Microsystems, Inc., CloudBees, Inc., Oleg Nenashev and other contributors</Copyright>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(TargetFramework)' != 'netcoreapp3.1'">
|
||||
<PropertyGroup Condition="'$(TargetFramework)' == 'net5.0-windows' AND '$(RuntimeIdentifier)' != ''">
|
||||
<PublishSingleFile>true</PublishSingleFile>
|
||||
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(TargetFramework)' != 'net5.0-windows'">
|
||||
<ILMergeVersion>3.0.41</ILMergeVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net5.0-windows'">
|
||||
<PackageReference Include="System.ServiceProcess.ServiceController" Version="4.7.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' != 'netcoreapp3.1'">
|
||||
<ItemGroup Condition="'$(TargetFramework)' != 'net5.0-windows'">
|
||||
<PackageReference Include="ilmerge" Version="$(ILMergeVersion)" />
|
||||
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" />
|
||||
<Reference Include="System.ServiceProcess" />
|
||||
|
@ -33,14 +40,7 @@
|
|||
<ProjectReference Include="..\WinSW.Plugins\WinSW.Plugins.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PublishCoreZip" AfterTargets="Publish" Condition="'$(TargetFramework)' == 'netcoreapp3.1' and '$(RuntimeIdentifier)' == ''">
|
||||
|
||||
<MakeDir Directories="$(ArtifactsDir)" />
|
||||
<ZipDirectory SourceDirectory="$(PublishDir)" DestinationFile="$(ArtifactsDir)WinSW.NETCore31.zip" Overwrite="true" />
|
||||
|
||||
</Target>
|
||||
|
||||
<Target Name="PublishCoreExe" AfterTargets="Publish" Condition="'$(TargetFramework)' == 'netcoreapp3.1' and '$(RuntimeIdentifier)' != ''">
|
||||
<Target Name="PublishCoreExe" AfterTargets="Publish" Condition="'$(TargetFramework)' == 'net5.0-windows'">
|
||||
|
||||
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'win-x64'">
|
||||
<IdentifierSuffix>x64</IdentifierSuffix>
|
||||
|
@ -50,13 +50,13 @@
|
|||
<IdentifierSuffix>x86</IdentifierSuffix>
|
||||
</PropertyGroup>
|
||||
|
||||
<MakeDir Directories="$(ArtifactsDir)" />
|
||||
<Copy SourceFiles="$(PublishDir)$(TargetName).exe" DestinationFiles="$(ArtifactsDir)WinSW.NETCore31.$(IdentifierSuffix).exe" />
|
||||
<MakeDir Directories="$(ArtifactsPublishDir)" />
|
||||
<Copy SourceFiles="$(PublishDir)$(TargetName).exe" DestinationFiles="$(ArtifactsPublishDir)WinSW-$(IdentifierSuffix).exe" />
|
||||
|
||||
</Target>
|
||||
|
||||
<!-- Merge plugins and other DLLs into the executable -->
|
||||
<Target Name="Merge" BeforeTargets="AfterBuild" Condition="'$(TargetFramework)' != 'netcoreapp3.1'">
|
||||
<Target Name="Merge" BeforeTargets="AfterBuild" Condition="'$(TargetFramework)' != 'net5.0-windows'">
|
||||
|
||||
<PropertyGroup Condition="'$(TargetFramework)' == 'net20'">
|
||||
<TargetPlatform>v2</TargetPlatform>
|
||||
|
@ -80,7 +80,7 @@
|
|||
<InputAssemblies>$(InputAssemblies) "$(OutDir)WinSW.Plugins.dll"</InputAssemblies>
|
||||
<InputAssemblies>$(InputAssemblies) "$(OutDir)log4net.dll"</InputAssemblies>
|
||||
<InputAssemblies>$(InputAssemblies) "$(OutDir)YamlDotNet.dll"</InputAssemblies>
|
||||
<OutputAssembly>"$(ArtifactsDir)WinSW.$(IdentifierSuffix).exe"</OutputAssembly>
|
||||
<OutputAssembly>"$(ArtifactsPublishDir)WinSW.$(IdentifierSuffix).exe"</OutputAssembly>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(TargetFramework)' == 'net20' or '$(TargetFramework)' == 'net40'">
|
||||
|
@ -93,8 +93,7 @@
|
|||
<ILMergeCommand>"$(ILMerge)" $(ILMergeArgs)</ILMergeCommand>
|
||||
</PropertyGroup>
|
||||
|
||||
<MakeDir Directories="$(ArtifactsDir)" />
|
||||
<Message Text="$(ILMergeCommand)" Importance="high" />
|
||||
<MakeDir Directories="$(ArtifactsPublishDir)" />
|
||||
<Exec Command="$(ILMergeCommand)" />
|
||||
|
||||
</Target>
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace WinSW
|
|||
internal WinSWExtensionManager ExtensionManager { get; private set; }
|
||||
|
||||
private static readonly ILog Log = LogManager.GetLogger(
|
||||
#if NETCOREAPP
|
||||
#if NET
|
||||
Assembly.GetExecutingAssembly(),
|
||||
#endif
|
||||
"WinSW");
|
||||
|
|
Loading…
Reference in New Issue