Skip to content

Commit

Permalink
Migrate Agent.Service to .NET 6
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisRumyantsev committed Mar 26, 2024
1 parent 03113b6 commit b5b7be8
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 58 deletions.
3 changes: 1 addition & 2 deletions src/Agent.Service/Windows/AgentService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Licensed under the MIT License.

using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
Expand Down Expand Up @@ -352,6 +351,6 @@ private enum AgentUpdateResult
private static extern bool SetConsoleCtrlHandler(ConsoleCtrlDelegate HandlerRoutine, bool Add);

// Delegate type to be used as the Handler Routine for SetConsoleCtrlHandler
delegate Boolean ConsoleCtrlDelegate(uint CtrlType);
private delegate bool ConsoleCtrlDelegate(uint CtrlType);
}
}
52 changes: 11 additions & 41 deletions src/Agent.Service/Windows/AgentService.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Project ToolsVersion="17.0" Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
Expand All @@ -12,7 +10,9 @@
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>FinalPublicKey.snk</AssemblyOriginatorKeyFile>
<DelaySign>true</DelaySign>
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
<TargetFramework>net6.0</TargetFramework>
<TargetFrameworkVersion>v6.0.28</TargetFrameworkVersion>
<RuntimeIdentifier>$(PackageRuntime)</RuntimeIdentifier>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
Expand All @@ -39,60 +39,30 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AgentService.cs">
<Compile Update="AgentService.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="AgentService.Designer.cs">
<Compile Update="AgentService.Designer.cs">
<DependentUpon>AgentService.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Resource.Designer.cs">
<Compile Update="Resource.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resource.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="FinalPublicKey.snk" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resource.de-de.resx">
</EmbeddedResource>
<EmbeddedResource Include="Resource.es-es.resx">
</EmbeddedResource>
<EmbeddedResource Include="Resource.fr-fr.resx">
</EmbeddedResource>
<EmbeddedResource Include="Resource.it-IT.resx">
</EmbeddedResource>
<EmbeddedResource Include="Resource.ja-jp.resx">
</EmbeddedResource>
<EmbeddedResource Include="Resource.ko-KR.resx">
</EmbeddedResource>
<EmbeddedResource Include="Resource.resx">
<EmbeddedResource Update="Resource.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resource.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="Resource.ru-RU.resx">
</EmbeddedResource>
<EmbeddedResource Include="Resource.zh-CN.resx">
</EmbeddedResource>
<EmbeddedResource Include="Resource.zh-TW.resx">
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<PackageReference Include="System.ServiceProcess.ServiceController" Version="6.0.1" />
</ItemGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
Expand Down
6 changes: 0 additions & 6 deletions src/Agent.Service/Windows/App.config

This file was deleted.

19 changes: 11 additions & 8 deletions src/Agent.Service/Windows/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,23 @@
// Licensed under the MIT License.

using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Resources;
using System.Runtime.Versioning;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("AgentService")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AgentService")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: SupportedOSPlatform("windows")]
// [assembly: AssemblyTitle("AgentService")]
// [assembly: AssemblyConfiguration("")]
// [assembly: AssemblyCompany("")]
// [assembly: AssemblyProduct("AgentService")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
Expand All @@ -35,5 +38,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
// [assembly: AssemblyVersion("1.0.0.0")]
// [assembly: AssemblyFileVersion("1.0.0.0")]
10 changes: 9 additions & 1 deletion src/dir.proj
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,21 @@
SkipNonExistentProjects="false"
StopOnFirstFailure="true" />

<MSBuild Targets="Restore"
BuildInParallel="false"
Projects="Agent.Service/Windows/AgentService.csproj"
SkipNonExistentProjects="false"
StopOnFirstFailure="true"
Properties="PackageRuntime=$(PackageRuntime);RuntimeIdentifier=$(PackageRuntime)"
Condition="'$(PackageRuntime)' == 'win-x64' Or '$(PackageRuntime)' == 'win-x86'" />

<MSBuild Targets="Publish"
BuildInParallel="false"
Projects="@(ProjectFiles)"
SkipNonExistentProjects="false"
StopOnFirstFailure="true"
Properties="Configuration=$(BUILDCONFIG);PackageRuntime=$(PackageRuntime);Version=$(AgentVersion);RuntimeIdentifier=$(PackageRuntime);PublishDir=$(LayoutRoot)/bin;TreatWarningsAsErrors=$(TreatWarningsAsErrors)" />
<Exec Command="%22$(DesktopMSBuild)%22 Agent.Service/Windows/AgentService.csproj /p:Configuration=$(BUILDCONFIG) /p:OutputPath=%22$(LayoutRoot)/bin%22 /p:TreatWarningsAsErrors=$(TreatWarningsAsErrors)" ConsoleToMSBuild="true" Condition="'$(PackageRuntime)' == 'win-x64' Or '$(PackageRuntime)' == 'win-x86'" />
<Exec Command="%22$(DesktopMSBuild)%22 Agent.Service/Windows/AgentService.csproj /p:PackageRuntime=$(PackageRuntime) /p:Configuration=$(BUILDCONFIG) /p:OutputPath=%22$(LayoutRoot)/bin%22 /p:TreatWarningsAsErrors=$(TreatWarningsAsErrors)" ConsoleToMSBuild="true" Condition="'$(PackageRuntime)' == 'win-x64' Or '$(PackageRuntime)' == 'win-x86'" />
</Target>

<Target Name="TestL0" DependsOnTargets="GenerateConstant">
Expand Down

0 comments on commit b5b7be8

Please sign in to comment.