File tree Expand file tree Collapse file tree 6 files changed +9
-26
lines changed Expand file tree Collapse file tree 6 files changed +9
-26
lines changed Original file line number Diff line number Diff line change 1414
1515 steps :
161617-
18- - name : Install NET 7
19- uses : actions/setup-dotnet@v2
20- with :
21- dotnet-version : ' 7.0.x'
22-
17+
2318 - name : Get the version
2419 id : get_version
2520 run : echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
5348
5449 - name : Publish API
5550 if : ${{ github.event.release.prerelease == false }}
56- run : dotnet publish "MessagingService\MessagingService.csproj" --configuration Release --output publishOutput
51+ run : dotnet publish "MessagingService\MessagingService.csproj" --configuration Release --output publishOutput -r win-x64 --self-contained
5752
5853 - name : Install Octopus CLI
5954 if : ${{ github.event.release.prerelease == false }}
Original file line number Diff line number Diff line change 4141
4242 steps :
434344-
45- - name : Install NET 7
46- uses : actions/setup-dotnet@v3
47- with :
48- dotnet-version : ' 7.0.101'
4944
5045 - name : Set Up Variables
5146 run : echo "action_url=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" >> $GITHUB_ENV
Original file line number Diff line number Diff line change 1616 steps :
17171818
19- - name : Install NET 7
20- uses : actions/setup-dotnet@v2
21- with :
22- dotnet-version : ' 7.0.x'
23-
2419 - name : Restore Nuget Packages
2520 run : dotnet restore MessagingService.sln --source https://api.nuget.org/v3/index.json --source https://www.myget.org/F/transactionprocessing/api/v3/index.json
2621
Original file line number Diff line number Diff line change 1919 with :
2020 fetch-depth : 0
2121
22- - name : Install NET 7
23- uses : actions/setup-dotnet@v2
24- with :
25- dotnet-version : ' 7.0.x'
26-
2722 - name : Restore Nuget Packages
2823 run : dotnet restore MessagingService.sln --source https://api.nuget.org/v3/index.json --source https://www.myget.org/F/transactionprocessing/api/v3/index.json
2924
Original file line number Diff line number Diff line change 1616 <PackageReference Include =" AspNetCore.HealthChecks.Uris" Version =" 6.0.3" />
1717 <PackageReference Include =" Microsoft.AspNetCore.Authentication.JwtBearer" Version =" 7.0.0" />
1818 <PackageReference Include =" Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version =" 7.0.0" />
19+ <PackageReference Include =" Microsoft.Extensions.Hosting.Abstractions" Version =" 7.0.0" />
1920 <PackageReference Include =" Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version =" 1.17.0" />
2021 <PackageReference Include =" Shared" Version =" 2023.1.0" />
2122 <PackageReference Include =" Microsoft.Extensions.Logging.Console" Version =" 7.0.0" />
2728 <PackageReference Include =" Swashbuckle.AspNetCore.Swagger" Version =" 6.4.0" />
2829 <PackageReference Include =" Swashbuckle.AspNetCore.SwaggerGen" Version =" 6.4.0" />
2930 <PackageReference Include =" Swashbuckle.AspNetCore.SwaggerUI" Version =" 6.4.0" />
31+ <PackageReference Include =" Microsoft.Extensions.Hosting.WindowsServices" Version =" 7.0.0" />
3032 </ItemGroup >
3133
3234 <ItemGroup >
Original file line number Diff line number Diff line change @@ -20,15 +20,16 @@ public static void Main(string[] args)
2020
2121 public static IHostBuilder CreateHostBuilder ( string [ ] args )
2222 {
23- Console . Title = "Messaging Service" ;
24-
2523 //At this stage, we only need our hosting file for ip and ports
26- IConfigurationRoot config = new ConfigurationBuilder ( ) . SetBasePath ( Directory . GetCurrentDirectory ( ) )
27- . AddJsonFile ( "hosting.json" , optional : true )
24+ FileInfo fi = new FileInfo ( System . Reflection . Assembly . GetExecutingAssembly ( ) . Location ) ;
25+
26+ IConfigurationRoot config = new ConfigurationBuilder ( ) . SetBasePath ( fi . Directory . FullName )
27+ . AddJsonFile ( "hosting.json" , optional : false )
2828 . AddJsonFile ( "hosting.development.json" , optional : true )
2929 . AddEnvironmentVariables ( ) . Build ( ) ;
3030
3131 IHostBuilder hostBuilder = Host . CreateDefaultBuilder ( args ) ;
32+ hostBuilder . UseWindowsService ( ) ;
3233 hostBuilder . UseLamar ( ) ;
3334 hostBuilder . ConfigureLogging ( logging =>
3435 {
You can’t perform that action at this time.
0 commit comments