Prismをデバッグする。
Prismをデバッグをするためにソリューションを専用に用意しました。開発中のソリューションに対してPrismのデバッグ環境を整えるのはあまりお勧めできません。というのも思ったよりサクッとデバッグできるわけでもないしPrismプロジェクト自体を追加しないといけないのでソリューションの管理という観点では少し面倒だなと思ったからです。
Prismを使ったソリューションを用意する
公式の説明を見るとプロジェクトを追加するだけでいいというような感じの説明でしたけど、これ自体がちょっと面倒です。なので冒頭でも言いましたが、 Prism 自体をデバックするためのソリューションを準備することをお勧めします。
Prismライブラリ自体をダウンロードしてくる
Prism ライブラリーを git クローンでダウンロードしてくる。srcディレクトリの中にソリューションファイルがあります。デバックするためにビルドしておく必要があるかなと思ったのでビルドしておきました。
git clone https://github.com/PrismLibrary/Prism.git
Prism is a framework for building loosely coupled, maintainable, and testable XAML applications in WPF, Xamarin Forms, and Uno / Win UI Applications..
https://github.com/PrismLibrary/Prism
1,644 forks.
6,774 stars.
33 open issues.
Recent commits:
- Merge pull request #3392 from PrismLibrary/uno-testsAdds Uno.WinUI and DryIoc.Uno.WinUI unit tests, GitHub
- Upgrade workflow templates to v2 and configure explicit test executionUpdates all build, CI, and release workflows to use version `v2` of the shared `avantipoint/workflow-templates`.This change standardizes how unit tests are executed by replacing the `run-tests` flag with a new `test-projects` input, allowing explicit definition of test project paths for each platform (Core, WPF, Uno, MAUI, Avalonia).Additionally, Uno platform builds are updated to target .NET 10.0.100 and related tooling versions, including Uno.Check version 1.33.1 and `tvos` workload installation., Dan Siegel
- Add unit tests for Prism.Uno.WinUI and Prism.DryIoc.Uno.WinUIIntroduces a comprehensive test suite for Uno Platform projects, including API contract verification, container integration, region management, and dialog services. This also enables test execution in the CI/CD workflows and adds coverlet.msbuild to support code coverage reporting., Dan Siegel
- Refines MAUI Dialog Layout and Active State Management (#3390)* check to see if dialog page is attached to window* fix race condition in dialog service navigation state updatesEnsures that PageNavigationSource and IsActive state updates are deferred until the dialog has been pushed by using ContinueWith on the asynchronous ConfigureLayout call. This prevents state updates from executing before the modal is actually displayed.* fixed window deactivation state* fix dialog mask layout and tap gesture reliabilityReplaces the root AbsoluteLayout in DialogContainerPage with a Grid. This ensures the background mask fills the screen naturally without needing proportional sizing or explicit WidthRequest/HeightRequest bindings, which were causing tap gestures to fail on some MAUI platforms., GitHub
- check to see if dialog page is attached to window (#3389), GitHub
ソリューションにダウンロードしたPrismのプロジェクトを追加する
プロジェクトの依存関係から確認すると、Prism.Unity.Formsを使っていることがわかる。Prism\src\Forms\Prism.Unity.Forms\Prism.Unity.Forms.csprojを追加します。
これだけだとエラーが出ているので、 Prism.Unity.Formsの依存も解決してあげる。以下のプロジェクトを追加しました。
C:\code\Prism\src\Forms\Prism.Forms\Prism.Forms.csproj
C:\code\Prism\src\Prism.Core\Prism.Core.csproj
C:\code\Prism\src\Containers\Prism.Unity.Shared\Prism.Unity.Shared.shproj
[ビルド] メニューの [構成マネージャ] を修正する
Prism のプロジェクトは既にビルドしているので今後ビルドする必要はないはずです。なので、ビルドの構成マネージャーで☑を外しておく。
追加したプロジェクトに対して参照を追加する
既存のプロジェクトを追加しただけだと、エラーが出たままでした。原因は Prism 参照がnugetで解決されたもののままだから。したがって、今回追加したプロジェクトの参照を自分で追加する。
すべての Prism プロジェクトの参照設定が終わりましたが、まだエラーが出ています。エラーの内容を見ると the MARINE ホームズのパッケージのバージョンが Prism から参照されてるものと異なるためかと思います。
したがってここでもXamarin.Formsの対応するバージョンにダウングレードするために対象のXmarin.Formsをnugetからダウンロードする。
これでエラーが消えたと思いましたが、Androidプロジェクトをビルドしてみるエラーがまだ出る。
まだ残っている

Android プロジェクトにも同様に参照関係を追加してあげる。
これでAndroidプロジェクトに対してはPrismプロジェクト内までデバッグできます。つまり、F11で中まで見ていくことができます。
これと同様に、iOSなどの個別プロジェクトの参照を修正すればそれぞれでデバッグできるはずです。
ディスカッション
コメント一覧
まだ、コメントがありません