---
phase: 01-foundation
plan: 01
type: execute
wave: 1
depends_on: []
files_modified:
  - SharepointToolbox/SharepointToolbox.csproj
  - SharepointToolbox/App.xaml
  - SharepointToolbox/App.xaml.cs
  - SharepointToolbox.Tests/SharepointToolbox.Tests.csproj
  - SharepointToolbox.Tests/Services/ProfileServiceTests.cs
  - SharepointToolbox.Tests/Services/SettingsServiceTests.cs
  - SharepointToolbox.Tests/Auth/MsalClientFactoryTests.cs
  - SharepointToolbox.Tests/Auth/SessionManagerTests.cs
  - SharepointToolbox.Tests/ViewModels/FeatureViewModelBaseTests.cs
  - SharepointToolbox.Tests/Localization/TranslationSourceTests.cs
  - SharepointToolbox.Tests/Integration/LoggingIntegrationTests.cs
  - SharepointToolbox.sln
autonomous: true
requirements:
  - FOUND-01
must_haves:
  truths:
    - "dotnet build produces zero errors"
    - "dotnet test produces zero test failures (all tests pending/skipped)"
    - "Solution contains two projects: SharepointToolbox (WPF) and SharepointToolbox.Tests (xUnit)"
    - "App.xaml has no StartupUri — Generic Host entry point is wired"
  artifacts:
    - path: "SharepointToolbox/SharepointToolbox.csproj"
      provides: "WPF .NET 10 project with all NuGet packages"
      contains: "PublishTrimmed>false"
    - path: "SharepointToolbox/App.xaml.cs"
      provides: "Generic Host entry point with [STAThread]"
      contains: "Host.CreateDefaultBuilder"
    - path: "SharepointToolbox.Tests/SharepointToolbox.Tests.csproj"
      provides: "xUnit test project"
      contains: "xunit"
    - path: "SharepointToolbox.sln"
      provides: "Solution file with both projects"
  key_links:
    - from: "SharepointToolbox/App.xaml.cs"
      to: "SharepointToolbox/App.xaml"
      via: "x:Class reference + StartupUri removed"
      pattern: "StartupUri"
    - from: "SharepointToolbox/SharepointToolbox.csproj"
      to: "App.xaml"
      via: "Page include replacing ApplicationDefinition"
      pattern: "ApplicationDefinition"
---

<objective>
Create the solution scaffold: WPF .NET 10 project with all NuGet packages wired, Generic Host entry point, and xUnit test project with stub test files that compile but have no passing tests yet.

Purpose: Every subsequent plan builds on a compiling, test-wired foundation. Getting the Generic Host + WPF STA threading right here prevents the most common startup crash.
Output: SharepointToolbox.sln with two projects, zero build errors, zero test failures on first run.
</objective>

<execution_context>
@C:/Users/SebastienQUEROL/.claude/get-shit-done/workflows/execute-plan.md
@C:/Users/SebastienQUEROL/.claude/get-shit-done/templates/summary.md
</execution_context>

<context>
@.planning/PROJECT.md
@.planning/ROADMAP.md
@.planning/STATE.md
@.planning/phases/01-foundation/01-CONTEXT.md
@.planning/phases/01-foundation/01-RESEARCH.md
</context>

<tasks>

<task type="auto">
  <name>Task 1: Create solution and WPF project with all NuGet packages</name>
  <files>
    SharepointToolbox.sln,
    SharepointToolbox/SharepointToolbox.csproj,
    SharepointToolbox/App.xaml,
    SharepointToolbox/App.xaml.cs,
    SharepointToolbox/MainWindow.xaml,
    SharepointToolbox/MainWindow.xaml.cs
  </files>
  <action>
    Run from the repo root:

    ```
    dotnet new sln -n SharepointToolbox
    dotnet new wpf -n SharepointToolbox -f net10.0-windows
    dotnet sln add SharepointToolbox/SharepointToolbox.csproj
    ```

    Edit SharepointToolbox/SharepointToolbox.csproj:
    - Set `<TargetFramework>net10.0-windows</TargetFramework>`
    - Add `<Nullable>enable</Nullable>`, `<ImplicitUsings>enable</ImplicitUsings>`
    - Add `<PublishTrimmed>false</PublishTrimmed>` (critical — PnP.Framework + MSAL use reflection)
    - Add `<StartupObject>SharepointToolbox.App</StartupObject>`
    - Add NuGet packages:
      - `CommunityToolkit.Mvvm` version 8.4.2
      - `Microsoft.Extensions.Hosting` version 10.x (latest 10.x)
      - `Microsoft.Identity.Client` version 4.83.1
      - `Microsoft.Identity.Client.Extensions.Msal` version 4.83.3
      - `Microsoft.Identity.Client.Broker` version 4.82.1
      - `PnP.Framework` version 1.18.0
      - `Serilog` version 4.3.1
      - `Serilog.Sinks.File` (latest)
      - `Serilog.Extensions.Hosting` (latest)
    - Change `<ApplicationDefinition Remove="App.xaml" />` and `<Page Include="App.xaml" />` to demote App.xaml from ApplicationDefinition

    Edit App.xaml: Remove `StartupUri="MainWindow.xaml"`. Keep `x:Class="SharepointToolbox.App"`.

    Edit App.xaml.cs: Replace default App class with Generic Host entry point pattern:
    ```csharp
    public partial class App : Application
    {
        [STAThread]
        public static void Main(string[] args)
        {
            using IHost host = Host.CreateDefaultBuilder(args)
                .UseSerilog((ctx, cfg) => cfg
                    .WriteTo.File(
                        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>();
        }
    }
    ```

    Leave MainWindow.xaml and MainWindow.xaml.cs as the default WPF template output — they will be replaced in plan 01-06.

    Run `dotnet build SharepointToolbox/SharepointToolbox.csproj` and fix any errors before moving to Task 2.
  </action>
  <verify>
    <automated>cd "C:\Users\dev\Documents\projets\Sharepoint" && dotnet build SharepointToolbox/SharepointToolbox.csproj --no-incremental 2>&1 | tail -5</automated>
  </verify>
  <done>Build output shows "Build succeeded" with 0 errors. App.xaml has no StartupUri. csproj contains PublishTrimmed=false and StartupObject.</done>
</task>

<task type="auto">
  <name>Task 2: Create xUnit test project with stub test files</name>
  <files>
    SharepointToolbox.Tests/SharepointToolbox.Tests.csproj,
    SharepointToolbox.Tests/Services/ProfileServiceTests.cs,
    SharepointToolbox.Tests/Services/SettingsServiceTests.cs,
    SharepointToolbox.Tests/Auth/MsalClientFactoryTests.cs,
    SharepointToolbox.Tests/Auth/SessionManagerTests.cs,
    SharepointToolbox.Tests/ViewModels/FeatureViewModelBaseTests.cs,
    SharepointToolbox.Tests/Localization/TranslationSourceTests.cs,
    SharepointToolbox.Tests/Integration/LoggingIntegrationTests.cs
  </files>
  <action>
    Run from the repo root:
    ```
    dotnet new xunit -n SharepointToolbox.Tests -f net10.0
    dotnet sln add SharepointToolbox.Tests/SharepointToolbox.Tests.csproj
    dotnet add SharepointToolbox.Tests/SharepointToolbox.Tests.csproj reference SharepointToolbox/SharepointToolbox.csproj
    ```

    Edit SharepointToolbox.Tests/SharepointToolbox.Tests.csproj:
    - Add `Moq` (latest) NuGet package
    - Add `Microsoft.NET.Test.Sdk` (already included in xunit template)
    - Add `<Nullable>enable</Nullable>`, `<ImplicitUsings>enable</ImplicitUsings>`

    Create stub test files — each file compiles but has a single `[Fact(Skip = "Not implemented yet")]` test so the suite passes (no failures, just skips):

    **SharepointToolbox.Tests/Services/ProfileServiceTests.cs**
    ```csharp
    namespace SharepointToolbox.Tests.Services;
    public class ProfileServiceTests
    {
        [Fact(Skip = "Wave 0 stub — implemented in plan 01-03")]
        public void SaveAndLoad_RoundTrips_Profiles() { }
    }
    ```

    Create identical stub pattern for:
    - `SettingsServiceTests.cs` — class `SettingsServiceTests`, skip reason "plan 01-03"
    - `MsalClientFactoryTests.cs` — class `MsalClientFactoryTests`, skip reason "plan 01-04"
    - `SessionManagerTests.cs` — class `SessionManagerTests`, skip reason "plan 01-04"
    - `FeatureViewModelBaseTests.cs` — class `FeatureViewModelBaseTests`, skip reason "plan 01-06"
    - `TranslationSourceTests.cs` — class `TranslationSourceTests`, skip reason "plan 01-05"
    - `LoggingIntegrationTests.cs` — class `LoggingIntegrationTests`, skip reason "plan 01-05"

    Run `dotnet test SharepointToolbox.Tests/SharepointToolbox.Tests.csproj --no-build` after building to confirm all tests are skipped (0 failed).
  </action>
  <verify>
    <automated>cd "C:\Users\dev\Documents\projets\Sharepoint" && dotnet test SharepointToolbox.Tests/SharepointToolbox.Tests.csproj 2>&1 | tail -10</automated>
  </verify>
  <done>dotnet test shows 0 failed, 7 skipped (or similar). All stub test files exist in correct subdirectories.</done>
</task>

</tasks>

<verification>
- `dotnet build SharepointToolbox.sln` succeeds with 0 errors
- `dotnet test SharepointToolbox.Tests/SharepointToolbox.Tests.csproj` shows 0 failures
- App.xaml contains no StartupUri attribute
- SharepointToolbox.csproj contains `<PublishTrimmed>false</PublishTrimmed>`
- SharepointToolbox.csproj contains `<StartupObject>SharepointToolbox.App</StartupObject>`
- App.xaml.cs Main method is decorated with `[STAThread]`
</verification>

<success_criteria>
Solution compiles cleanly. Both projects in the solution. Test runner executes without failures. Generic Host wiring is correct (most critical risk for this plan — wrong STA threading causes runtime crash).
</success_criteria>

<output>
After completion, create `.planning/phases/01-foundation/01-01-SUMMARY.md`
</output>
