Self-contained build - keine .NET Installation noetig
This commit is contained in:
parent
c963c4d9e9
commit
4493e6d0f1
5 changed files with 36 additions and 1 deletions
|
|
@ -1,5 +1,7 @@
|
||||||
<Project>
|
<Project>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
<SelfContained>true</SelfContained>
|
||||||
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
<!-- Version aus Git-Tag lesen: git tag v1.2.3 → Version 1.2.3 -->
|
<!-- Version aus Git-Tag lesen: git tag v1.2.3 → Version 1.2.3 -->
|
||||||
<GitVersion Condition="'$(GitVersion)' == ''">$([System.String]::Copy('1.0.0'))</GitVersion>
|
<GitVersion Condition="'$(GitVersion)' == ''">$([System.String]::Copy('1.0.0'))</GitVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,10 @@
|
||||||
<RootNamespace>MailPrint</RootNamespace>
|
<RootNamespace>MailPrint</RootNamespace>
|
||||||
<AssemblyName>MailPrint</AssemblyName>
|
<AssemblyName>MailPrint</AssemblyName>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
|
<SelfContained>true</SelfContained>
|
||||||
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
|
<NoWarn>$(NoWarn);1591</NoWarn>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,34 @@ try
|
||||||
builder.Services.AddControllers();
|
builder.Services.AddControllers();
|
||||||
builder.Services.AddEndpointsApiExplorer();
|
builder.Services.AddEndpointsApiExplorer();
|
||||||
builder.Services.AddSwaggerGen(c =>
|
builder.Services.AddSwaggerGen(c =>
|
||||||
c.SwaggerDoc("v1", new() { Title = "MailPrint API", Version = "v1" }));
|
{
|
||||||
|
c.SwaggerDoc("v1", new() { Title = "MailPrint API", Version = "v1" });
|
||||||
|
|
||||||
|
// XML-Doku aus /// Kommentaren in OpenAPI uebernehmen
|
||||||
|
var xmlPath = Path.Combine(AppContext.BaseDirectory, "MailPrint.xml");
|
||||||
|
if (File.Exists(xmlPath))
|
||||||
|
c.IncludeXmlComments(xmlPath);
|
||||||
|
|
||||||
|
// API-Key-Security im Schema dokumentieren -> generierte Clients
|
||||||
|
// setzen den Header automatisch, Swagger UI hat Authorize-Button
|
||||||
|
var scheme = new Microsoft.OpenApi.Models.OpenApiSecurityScheme
|
||||||
|
{
|
||||||
|
Name = "X-Api-Key",
|
||||||
|
Type = Microsoft.OpenApi.Models.SecuritySchemeType.ApiKey,
|
||||||
|
In = Microsoft.OpenApi.Models.ParameterLocation.Header,
|
||||||
|
Description = "API-Key fuer alle /api/* Endpunkte. Konfiguriert in MailPrintConfig.",
|
||||||
|
Reference = new Microsoft.OpenApi.Models.OpenApiReference
|
||||||
|
{
|
||||||
|
Type = Microsoft.OpenApi.Models.ReferenceType.SecurityScheme,
|
||||||
|
Id = "ApiKey"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
c.AddSecurityDefinition("ApiKey", scheme);
|
||||||
|
c.AddSecurityRequirement(new Microsoft.OpenApi.Models.OpenApiSecurityRequirement
|
||||||
|
{
|
||||||
|
[scheme] = Array.Empty<string>()
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
app.UseSwagger();
|
app.UseSwagger();
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,8 @@
|
||||||
<UseWindowsForms>true</UseWindowsForms>
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
<RootNamespace>MailPrintConfig</RootNamespace>
|
<RootNamespace>MailPrintConfig</RootNamespace>
|
||||||
<AssemblyName>MailPrintConfig</AssemblyName>
|
<AssemblyName>MailPrintConfig</AssemblyName>
|
||||||
|
<SelfContained>true</SelfContained>
|
||||||
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
BIN
publish.zip
Normal file
BIN
publish.zip
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue