<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>WinUI3 on AYU MAX</title>
    <link>https://ayumax.net/tags/winui3/</link>
    <description>Recent content in WinUI3 on AYU MAX</description>
    <image>
      <title>AYU MAX</title>
      <url>https://ayumax.net/profile.jpg</url>
      <link>https://ayumax.net/profile.jpg</link>
    </image>
    <generator>Hugo -- 0.147.1</generator>
    <language>en</language>
    <lastBuildDate>Fri, 07 Aug 2020 19:25:35 +0000</lastBuildDate>
    <atom:link href="https://ayumax.net/tags/winui3/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Updating a WinUI 3 Preview 1 Project to Preview 2</title>
      <link>https://ayumax.net/entry/2020/08/07/192535/</link>
      <pubDate>Fri, 07 Aug 2020 19:25:35 +0000</pubDate>
      <guid>https://ayumax.net/entry/2020/08/07/192535/</guid>
      <description>&lt;h1 id=&#34;winui-3-preview-2&#34;&gt;WinUI 3 Preview 2&lt;/h1&gt;
&lt;p&gt;I didn&amp;rsquo;t notice for about half a month, but WinUI 3 Preview 2 was released.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://docs.microsoft.com/en-us/windows/apps/winui/winui3/&#34;&gt;WinUI 3 Preview 2 (July 2020)&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;So, I tried updating the following WinUI 3 Desktop project, which I previously created using WinUI 3 Preview 1, to Preview 2.&lt;/p&gt;
&lt;p&gt;This is a record of that process.&lt;/p&gt;
&lt;p&gt;Since I basically just followed the official instructions, there isn&amp;rsquo;t much useful information here.&lt;/p&gt;
&lt;div class=&#34;github-card&#34; data-user=&#34;ayumax&#34; data-repo=&#34;WinUIExplorer&#34; data-width=&#34;400&#34; data-height=&#34;&#34; data-theme=&#34;default&#34;&gt;&lt;/div&gt;
&lt;script src=&#34;https://cdn.jsdelivr.net/github-cards/latest/widget.js&#34;&gt;&lt;/script&gt;
&lt;h1 id=&#34;updating-the-environment&#34;&gt;Updating the Environment&lt;/h1&gt;
&lt;p&gt;I&amp;rsquo;ll check the environment according to the description on the official page.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<h1 id="winui-3-preview-2">WinUI 3 Preview 2</h1>
<p>I didn&rsquo;t notice for about half a month, but WinUI 3 Preview 2 was released.</p>
<p><a href="https://docs.microsoft.com/en-us/windows/apps/winui/winui3/">WinUI 3 Preview 2 (July 2020)</a></p>
<p>So, I tried updating the following WinUI 3 Desktop project, which I previously created using WinUI 3 Preview 1, to Preview 2.</p>
<p>This is a record of that process.</p>
<p>Since I basically just followed the official instructions, there isn&rsquo;t much useful information here.</p>
<div class="github-card" data-user="ayumax" data-repo="WinUIExplorer" data-width="400" data-height="" data-theme="default"></div>
<script src="https://cdn.jsdelivr.net/github-cards/latest/widget.js"></script>
<h1 id="updating-the-environment">Updating the Environment</h1>
<p>I&rsquo;ll check the environment according to the description on the official page.</p>
<h3 id="ensure-windows-10-version-1803-build-17134-or-later-is-installed-on-your-development-computer">Ensure Windows 10 version 1803 (build 17134) or later is installed on your development computer</h3>
<p>I have Windows 10 2004, so it&rsquo;s OK.</p>
<h3 id="install-visual-studio-2019-version-167-preview-3">Install Visual Studio 2019 version 16.7 Preview 3</h3>
<p>Checking the version of the installed VS2019 Preview, it was 16.7.0 Preview 3.1.</p>
<p>So, I decided to proceed with this version.</p>
<figure>
    <img loading="lazy" src="/images/2020/08/07/192535/20200807183353.png"/> 
</figure>

<p>When I checked for updates, 16.8.0 Preview 1.0 was available, but since updating the .NET 5 version to the latest previously caused WinUI 3 Preview 1 to fail to launch, I decided against recklessly updating to the latest version.</p>
<figure>
    <img loading="lazy" src="/images/2020/08/07/192535/20200807183508.png"/> 
</figure>

<h3 id="net-5-preview-5">.NET 5 Preview 5</h3>
<p>It seems WinUI 3 Preview 2 supports .NET 5 Preview 5.
Checking the current latest version, Preview 7 was available, but to ensure it works reliably, I&rsquo;ll stick with Preview 5.</p>
<p>However, this time, the official page description didn&rsquo;t include the note &ldquo;Don&rsquo;t install anything newer than Preview 5&rdquo; (it did last time), so perhaps Preview 7 might work as well.</p>
<h3 id="install-the-winui-3-preview-2-vsix-package">Install the WinUI 3 Preview 2 VSIX package</h3>
<p>Install the extension for VS.
However, when I downloaded and tried to install it, it indicated that it was already installed, so I think it hasn&rsquo;t changed from Preview 1.</p>
<h1 id="updating-the-project">Updating the Project</h1>
<p>It seems that projects created with WinUI Preview 1 won&rsquo;t work as-is with Preview 2, and some edits are necessary.</p>
<p>Details are written on the following page.</p>
<div class="github-card" data-user="microsoft/microsoft-ui-xaml/blob/master/docs" data-repo="preview_upgrade_instructions.md" data-width="400" data-height="" data-theme="default"></div>
<script src="https://cdn.jsdelivr.net/github-cards/latest/widget.js"></script>
<p>Now, let&rsquo;s edit according to the page above.</p>
<h3 id="install-microsoftwinui-preview-2-via-nuget">Install Microsoft.WinUI Preview 2 via NuGet</h3>
<p>It didn&rsquo;t show up when searching in the NuGet Package Manager.</p>
<p>However, the workaround was also described: install it from the Package Manager Console by entering <code>install-package Microsoft.WinUI -Version 3.0.0-preview2.200713.0</code>.</p>
<h3 id="edit-csproj">Edit .csproj</h3>
<p>Change the TargetFramework description from <code>netcoreapp5.0</code> to <code>net5.0</code>.</p>
<p>That&rsquo;s all for this file.</p>
<h3 id="edit-wapproj">Edit .wapproj</h3>
<p>Edit the package project&rsquo;s configuration file (.wapproj) in a few places.</p>
<h4 id="change-1">Change 1</h4>
<p>Insert the line <code>&lt;AppxTargetsLocation Condition=&quot;'$(AppxTargetsLocation)'==''&quot;&gt;$(MSBuildThisFileDirectory)build\&lt;/AppxTargetsLocation&gt;</code> inside the <code>PropertyGroup</code> after <code>&lt;Import Project=&quot;$(WapProjPath)\Microsoft.DesktopBridge.props&quot; /&gt;</code>.</p>
<h4 id="change-2">Change 2</h4>
<p>Change <code>&lt;Import Project=&quot;build\Microsoft.WinUI.AppX.targets&quot; /&gt;</code> to <code>&lt;Import Project=&quot;$(AppxTargetsLocation)Microsoft.WinUI.AppX.targets&quot; /&gt;</code>.</p>
<h3 id="replace-files-in-the-package-projects-build-folder">Replace files in the package project&rsquo;s build folder</h3>
<p>First, create a new project.
This is disposable, so creating it in a temporary folder is fine.</p>
<p>Use the <code>Blank App, Packaged (WinUI in Desktop)</code> template.</p>
<p>Once the project is created, copy the following two files from <code>[Package project folder]/build/</code>:</p>
<ul>
<li>LiftedWinRTClassRegistrations.xml</li>
<li>Microsoft.WinUI.AppX.targets</li>
</ul>
<p>Then, overwrite the files in the same hierarchy in your own package project.</p>
<h1 id="build-and-run">Build and Run</h1>
<p>After restarting VS, building, and running, it launched properly.</p>
<blockquote class="twitter-tweet"><p lang="ja" dir="ltr">儀式完了。WinUI Preview1のプロジェクトをPreview2にアップデートできた。 <a href="https://t.co/b509OoP6K8">pic.twitter.com/b509OoP6K8</a></p>&mdash; ayuma (@ayuma_x) <a href="https://twitter.com/ayuma_x/status/1291015445181390850?ref_src=twsrc%5Etfw">August 5, 2020</a></blockquote>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>


<p>It seems many bugs have been fixed in WinUI 3 Preview 2 compared to Preview 1, so I&rsquo;d like to explore various aspects.</p>
]]></content:encoded>
    </item>
  </channel>
</rss>
