build script for maui apk adjusted 2 #2

Open
itob wants to merge 29 commits from development into master
8 changed files with 86 additions and 21 deletions
Showing only changes of commit f185b54902 - Show all commits

View File

@ -1,4 +1,5 @@
using CommunityToolkit.Maui; using System.Reflection;
using CommunityToolkit.Maui;
using CommunityToolkit.Maui.Markup; using CommunityToolkit.Maui.Markup;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
@ -40,9 +41,16 @@ namespace RBLNews.Maui
builder.Logging.AddDebug(); builder.Logging.AddDebug();
#endif #endif
Stream? appSettingFile = Assembly.GetExecutingAssembly().GetManifestResourceStream($"appsettings.json");
if (appSettingFile != null)
{
IConfiguration configuration = new ConfigurationManager().AddJsonStream(appSettingFile).Build();
builder.Configuration.AddConfiguration(configuration);
}
MauiApp app = builder.Build(); MauiApp app = builder.Build();
AppSettingsModel? appSettings = app.Configuration.GetSection("Logging").Get<AppSettingsModel>(); AppSettingsModel? appSettings = app.Configuration.GetSection("App").Get<AppSettingsModel>();
if (string.IsNullOrEmpty(appSettings?.BackendApiUrl)) if (string.IsNullOrEmpty(appSettings?.BackendApiUrl))
{ {

View File

@ -2,7 +2,10 @@
"profiles": { "profiles": {
"Windows Machine": { "Windows Machine": {
"commandName": "MsixPackage", "commandName": "MsixPackage",
"nativeDebugging": false "nativeDebugging": false,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
} }
} }
} }

View File

@ -86,9 +86,7 @@
<EmbeddedResource Include="appsettings.json"> <EmbeddedResource Include="appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="appsettings.Production.json"> <EmbeddedResource Include="appsettings.Production.json" />
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="appsettings.Test.json"> <EmbeddedResource Include="appsettings.Test.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource> </EmbeddedResource>
@ -98,6 +96,8 @@
<PackageReference Include="Blazor.Bootstrap" Version="3.0.0" /> <PackageReference Include="Blazor.Bootstrap" Version="3.0.0" />
<PackageReference Include="CommunityToolkit.Maui" Version="9.0.3" /> <PackageReference Include="CommunityToolkit.Maui" Version="9.0.3" />
<PackageReference Include="CommunityToolkit.Maui.Markup" Version="4.1.0" /> <PackageReference Include="CommunityToolkit.Maui.Markup" Version="4.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.2" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.90" /> <PackageReference Include="Microsoft.Maui.Controls" Version="8.0.90" />
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.90" /> <PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.90" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebView.Maui" Version="8.0.90" /> <PackageReference Include="Microsoft.AspNetCore.Components.WebView.Maui" Version="8.0.90" />

View File

@ -7,6 +7,28 @@
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS> <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<Content Remove="appsettings.Development.json" />
<Content Remove="appsettings.json" />
<Content Remove="appsettings.Production.json" />
<Content Remove="appsettings.Test.json" />
</ItemGroup>
<ItemGroup>
<Content Include="appsettings.Development.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="appsettings.Production.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="appsettings.Test.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\RBLNews.Shared\RBLNews.Shared.csproj" /> <ProjectReference Include="..\RBLNews.Shared\RBLNews.Shared.csproj" />
</ItemGroup> </ItemGroup>
@ -19,18 +41,6 @@
<Content Update="wwwroot\fonts\NanumMyeongjo-Regular.ttf"> <Content Update="wwwroot\fonts\NanumMyeongjo-Regular.ttf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content> </Content>
<Content Include="..\RBLNews.Shared\wwwroot\appsettings.Development.json">
<Link>appsettings.Development.json</Link>
</Content>
<Content Include="..\RBLNews.Shared\wwwroot\appsettings.json">
<Link>appsettings.json</Link>
</Content>
<Content Include="..\RBLNews.Shared\wwwroot\appsettings.Production.json">
<Link>appsettings.Production.json</Link>
</Content>
<Content Include="..\RBLNews.Shared\wwwroot\appsettings.Test.json">
<Link>appsettings.Test.json</Link>
</Content>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -0,0 +1,11 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"App": {
"BackendApiUrl": "https://localhost:5147"
}
}

View File

@ -0,0 +1,12 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"App": {
"BackendApiUrl": "https://rblnews.de"
}
}

View File

@ -0,0 +1,12 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"App": {
"BackendApiUrl": "https://rbl.wohlleben.dev"
}
}

View File

@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}