feat(01-01): create WPF solution with Generic Host entry point and NuGet packages
- SharepointToolbox.slnx solution with WPF project - net10.0-windows target, PublishTrimmed=false, StartupObject set - App.xaml StartupUri removed, App demoted from ApplicationDefinition to Page - App.xaml.cs: [STAThread] Main with Host.CreateDefaultBuilder + Serilog rolling file - All NuGet packages: CommunityToolkit.Mvvm 8.4.2, MSAL 4.83.3, PnP.Framework 1.18.0, Serilog 4.3.1 - Build: 0 errors, 0 warnings
This commit is contained in:
3
SharepointToolbox.slnx
Normal file
3
SharepointToolbox.slnx
Normal file
@@ -0,0 +1,3 @@
|
||||
<Solution>
|
||||
<Project Path="SharepointToolbox/SharepointToolbox.csproj" />
|
||||
</Solution>
|
||||
8
SharepointToolbox/App.xaml
Normal file
8
SharepointToolbox/App.xaml
Normal file
@@ -0,0 +1,8 @@
|
||||
<Application x:Class="SharepointToolbox.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:SharepointToolbox">
|
||||
<Application.Resources>
|
||||
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
40
SharepointToolbox/App.xaml.cs
Normal file
40
SharepointToolbox/App.xaml.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Serilog;
|
||||
using System.Windows;
|
||||
|
||||
namespace SharepointToolbox;
|
||||
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
[STAThread]
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
using IHost host = Host.CreateDefaultBuilder(args)
|
||||
.UseSerilog((ctx, cfg) => cfg
|
||||
.WriteTo.File(
|
||||
System.IO.Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
|
||||
"SharepointToolbox", "logs", "app-.log"),
|
||||
rollingInterval: RollingInterval.Day,
|
||||
retainedFileCountLimit: 30))
|
||||
.ConfigureServices(RegisterServices)
|
||||
.Build();
|
||||
|
||||
host.Start();
|
||||
App app = new();
|
||||
app.InitializeComponent();
|
||||
app.MainWindow = host.Services.GetRequiredService<MainWindow>();
|
||||
app.MainWindow.Visibility = Visibility.Visible;
|
||||
app.Run();
|
||||
}
|
||||
|
||||
private static void RegisterServices(HostBuilderContext ctx, IServiceCollection services)
|
||||
{
|
||||
// Placeholder — services registered in subsequent plans
|
||||
services.AddSingleton<MainWindow>();
|
||||
}
|
||||
}
|
||||
12
SharepointToolbox/MainWindow.xaml
Normal file
12
SharepointToolbox/MainWindow.xaml
Normal file
@@ -0,0 +1,12 @@
|
||||
<Window x:Class="SharepointToolbox.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:SharepointToolbox"
|
||||
mc:Ignorable="d"
|
||||
Title="MainWindow" Height="450" Width="800">
|
||||
<Grid>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
23
SharepointToolbox/MainWindow.xaml.cs
Normal file
23
SharepointToolbox/MainWindow.xaml.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace SharepointToolbox;
|
||||
|
||||
/// <summary>
|
||||
/// Interaction logic for MainWindow.xaml
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
30
SharepointToolbox/SharepointToolbox.csproj
Normal file
30
SharepointToolbox/SharepointToolbox.csproj
Normal file
@@ -0,0 +1,30 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net10.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UseWPF>true</UseWPF>
|
||||
<PublishTrimmed>false</PublishTrimmed>
|
||||
<StartupObject>SharepointToolbox.App</StartupObject>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Remove="App.xaml" />
|
||||
<Page Include="App.xaml" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.2" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="10.0.0" />
|
||||
<PackageReference Include="Microsoft.Identity.Client" Version="4.83.3" />
|
||||
<PackageReference Include="Microsoft.Identity.Client.Broker" Version="4.82.1" />
|
||||
<PackageReference Include="Microsoft.Identity.Client.Extensions.Msal" Version="4.83.3" />
|
||||
<PackageReference Include="PnP.Framework" Version="1.18.0" />
|
||||
<PackageReference Include="Serilog" Version="4.3.1" />
|
||||
<PackageReference Include="Serilog.Extensions.Hosting" Version="10.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="7.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user