Skip to content

Commit

Permalink
Simplify published result
Browse files Browse the repository at this point in the history
Remove web.config because we don't need IIS support, do not publish
appsettings.Development.json.
  • Loading branch information
aristotelos committed Mar 22, 2024
1 parent a2880d0 commit 1712283
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 90 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ jobs:
working-directory: ./src

# Unfortunately, --no-build does not seem to work when we publish a specific project, so we use --no-restore instead
# Skip adding a web.config for IIS, as we will always use Kestrel (IsTransformWebConfigDisabled=true)
- name: Publish
run: dotnet publish FlaUI.WebDriver/FlaUI.WebDriver.csproj --no-restore --configuration $env:Configuration --self-contained
run: dotnet publish FlaUI.WebDriver/FlaUI.WebDriver.csproj --no-restore --configuration $env:Configuration --self-contained /p:IsTransformWebConfigDisabled=true
working-directory: ./src

- name: Upload build artifacts
Expand Down
5 changes: 5 additions & 0 deletions src/FlaUI.WebDriver.sln
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FlaUI.WebDriver.UITests", "
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WpfApplication", "TestApplications\WpfApplication\WpfApplication.csproj", "{23F0E331-C5AE-4D3D-B4E2-534D52E65CA0}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4F6F2546-27D9-468C-AD80-1629B54139DA}"
ProjectSection(SolutionItems) = preProject
..\README.md = ..\README.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
10 changes: 5 additions & 5 deletions src/FlaUI.WebDriver/FlaUI.WebDriver.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
<PropertyGroup Label="Build">
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>disable</ImplicitUsings>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>preview</LangVersion>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<RuntimeIdentifiers>win-x64</RuntimeIdentifiers>
<PublishSingleFile>true</PublishSingleFile>
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
</PropertyGroup>

<PropertyGroup>
<StartupObject>FlaUI.WebDriver.Program</StartupObject>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FlaUI.UIA3.Signed" Version="4.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
</ItemGroup>

<ItemGroup>
<Content Update="appsettings.*.json" CopyToPublishDirectory="Never" />
</ItemGroup>

</Project>
47 changes: 28 additions & 19 deletions src/FlaUI.WebDriver/Program.cs
Original file line number Diff line number Diff line change
@@ -1,22 +1,31 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
using System.IO;
using System.Reflection;
using FlaUI.WebDriver;
using Microsoft.OpenApi.Models;

namespace FlaUI.WebDriver
var builder = WebApplication.CreateBuilder(args);

builder.Services.AddSingleton<ISessionRepository, SessionRepository>();

builder.Services.Configure<RouteOptions>(options => options.LowercaseUrls = true);
builder.Services.AddControllers(options =>
options.Filters.Add(new WebDriverResponseExceptionFilter()));

builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(c =>
{
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}

public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
}
c.SwaggerDoc("v1", new OpenApiInfo { Title = "FlaUI.WebDriver", Version = "v1" });
});

var app = builder.Build();

// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "FlaUI.WebDriver v1"));
}

app.UseAuthorization();

app.MapControllers();

app.Run();
65 changes: 0 additions & 65 deletions src/FlaUI.WebDriver/Startup.cs

This file was deleted.

0 comments on commit 1712283

Please sign in to comment.