<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Publish single executable not working for .NET 5 or .NET 6 in .NET Maps SDK Questions</title>
    <link>https://community.esri.com/t5/net-maps-sdk-questions/publish-single-executable-not-working-for-net-5-or/m-p/1136336#M10730</link>
    <description>&lt;P&gt;Publishing a WPF application as a single executable does not work for .NET 5 (using ArcGIS Runtime 100.12) or .NET 6 (using ArcGIS Runtime 100.13). There are 11 files and a folder in the target folder. The application can be started, but the map will not work. If the exe is moved to another folder it cannot be started.&lt;/P&gt;&lt;P&gt;Publishing the WPF application as a single executable works for .NET Core 3.1 (using ArcGIS Runtime 100.12).&lt;/P&gt;&lt;P&gt;I used Visual Studio 2022 (17.0.5) in all cases and the following publishing settings:&lt;/P&gt;&lt;P&gt;Configuration: Release | Any CPU&lt;BR /&gt;Target framework: net6.0-windows10.0.18362 / net5.0-window10.0.18362.0 / netcoreapp3.1&lt;BR /&gt;Deployment mode: Self-contained&lt;BR /&gt;Target runtime: win-x64&lt;BR /&gt;File publish options:&lt;BR /&gt;&amp;nbsp; Produce single file: Checked&lt;BR /&gt;&amp;nbsp; Enable ReadyToRun compilation. Unchecked&lt;BR /&gt;&amp;nbsp; Trim unused code: Unchecked&lt;/P&gt;&lt;P&gt;Have I missed something that needs to be changed for it to work with .NET 5 and .NET 6?&lt;/P&gt;</description>
    <pubDate>Tue, 25 Jan 2022 11:00:11 GMT</pubDate>
    <dc:creator>mahj</dc:creator>
    <dc:date>2022-01-25T11:00:11Z</dc:date>
    <item>
      <title>Publish single executable not working for .NET 5 or .NET 6</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/publish-single-executable-not-working-for-net-5-or/m-p/1136336#M10730</link>
      <description>&lt;P&gt;Publishing a WPF application as a single executable does not work for .NET 5 (using ArcGIS Runtime 100.12) or .NET 6 (using ArcGIS Runtime 100.13). There are 11 files and a folder in the target folder. The application can be started, but the map will not work. If the exe is moved to another folder it cannot be started.&lt;/P&gt;&lt;P&gt;Publishing the WPF application as a single executable works for .NET Core 3.1 (using ArcGIS Runtime 100.12).&lt;/P&gt;&lt;P&gt;I used Visual Studio 2022 (17.0.5) in all cases and the following publishing settings:&lt;/P&gt;&lt;P&gt;Configuration: Release | Any CPU&lt;BR /&gt;Target framework: net6.0-windows10.0.18362 / net5.0-window10.0.18362.0 / netcoreapp3.1&lt;BR /&gt;Deployment mode: Self-contained&lt;BR /&gt;Target runtime: win-x64&lt;BR /&gt;File publish options:&lt;BR /&gt;&amp;nbsp; Produce single file: Checked&lt;BR /&gt;&amp;nbsp; Enable ReadyToRun compilation. Unchecked&lt;BR /&gt;&amp;nbsp; Trim unused code: Unchecked&lt;/P&gt;&lt;P&gt;Have I missed something that needs to be changed for it to work with .NET 5 and .NET 6?&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jan 2022 11:00:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/publish-single-executable-not-working-for-net-5-or/m-p/1136336#M10730</guid>
      <dc:creator>mahj</dc:creator>
      <dc:date>2022-01-25T11:00:11Z</dc:date>
    </item>
    <item>
      <title>Re: Publish single executable not working for .NET 5 or .NET 6</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/publish-single-executable-not-working-for-net-5-or/m-p/1137181#M10732</link>
      <description>&lt;P&gt;There was a change to the default behavior between .NET Core 3.1 and .NET 5.&lt;/P&gt;&lt;P&gt;Adding the following line to the ClickOnce .pubxml publish profile should solve the problem:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;IncludeAllContentForSelfExtract&amp;gt;True&amp;lt;/IncludeAllContentForSelfExtract&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Visual Studio/ClickOnce still produces additional files alongside the single-file executable, but they aren't necessary to run the single file app.&lt;/P&gt;&lt;P&gt;Alternatively, if you disable the 'Produce Single File' option, the publish will work without IncludeAllContentForSelfExtract line.&lt;/P&gt;&lt;P&gt;Microsoft has documentation on single file deployments that you might find helpful:&amp;nbsp;&lt;A href="https://docs.microsoft.com/en-us/dotnet/core/deploying/single-file#including-native-libraries" target="_blank"&gt;https://docs.microsoft.com/en-us/dotnet/core/deploying/single-file#including-native-libraries&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jan 2022 23:12:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/publish-single-executable-not-working-for-net-5-or/m-p/1137181#M10732</guid>
      <dc:creator>NathanCastle1</dc:creator>
      <dc:date>2022-01-25T23:12:06Z</dc:date>
    </item>
    <item>
      <title>Re: Publish single executable not working for .NET 5 or .NET 6</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/publish-single-executable-not-working-for-net-5-or/m-p/1137275#M10733</link>
      <description>&lt;P&gt;Thanks, now it works in both .NET 5 and .NET 6!&lt;/P&gt;&lt;P&gt;Tried adding&amp;nbsp;&lt;SPAN&gt;IncludeNativeLibrariesForSelfExtract instead, but then the app could not be started.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Awesome that someone at MS realized that just checking the 'Produce single file' option without adding another magic option in the .pubxml file was too hard to use ;-). (*irony very much intended*)&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jan 2022 07:32:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/publish-single-executable-not-working-for-net-5-or/m-p/1137275#M10733</guid>
      <dc:creator>mahj</dc:creator>
      <dc:date>2022-01-26T07:32:51Z</dc:date>
    </item>
  </channel>
</rss>

