<?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 Re: Single-file deployment failed in .NET Maps SDK Questions</title>
    <link>https://community.esri.com/t5/net-maps-sdk-questions/single-file-deployment-failed/m-p/1676434#M13842</link>
    <description>&lt;DIV&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;SPAN&gt;It looks like you'll need to add&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;lt;IncludeAllContentForSelfExtract&amp;gt;True&amp;lt;/IncludeAllContentForSelfExtract&amp;gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;to the project file. You can replace&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;IncludeNativeLibrariesForSelfExtract&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;since &lt;/SPAN&gt;&lt;SPAN&gt;IncludeAllContentForSelfExtract&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;should cover the same functionality. More info here: &lt;A href="https://learn.microsoft.com/en-us/dotnet/core/deploying/single-file/overview?tabs=vs#native-libraries" target="_self"&gt;https://learn.microsoft.com/en-us/dotnet/core/deploying/single-file/overview?tabs=vs#native-libraries&lt;/A&gt;.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;SPAN&gt;By default setting &lt;/SPAN&gt;&lt;SPAN&gt;IncludeAllContentForSelfExtract&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;will bundle the shapefile data specified in the &lt;/SPAN&gt;&lt;SPAN&gt;ItemGroup&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;and extract it to a temp folder at runtime. To return to the original behavior where you modify files in the same folder as the .exe file, a couple of changes are needed. First, you would replace the &lt;/SPAN&gt;&lt;SPAN&gt;ItemGroup&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;with a &lt;/SPAN&gt;&lt;SPAN&gt;Target&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;to copy the data manually like the following:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;Target Name="CopyShapefiles" AfterTargets="Build;Publish"&amp;gt;
    &amp;lt;ItemGroup&amp;gt;
        &amp;lt;ShapefileComponents Include="data\**\*.shp;data\**\*.dbf;data\**\*.shx;data\**\*.prj;data\**\*.cpg" /&amp;gt;
    &amp;lt;/ItemGroup&amp;gt;
    &amp;lt;!-- Copy to output directory (for when building without publishing) --&amp;gt;
    &amp;lt;Copy SourceFiles="@(ShapefileComponents)"
          DestinationFolder="$(OutputPath)%(RelativeDir)"
          SkipUnchangedFiles="true" /&amp;gt;
    &amp;lt;!-- Copy to publish directory (only applies to published builds) --&amp;gt;
    &amp;lt;Copy SourceFiles="@(ShapefileComponents)"
          DestinationFolder="$(PublishDir)%(RelativeDir)"
          SkipUnchangedFiles="true" /&amp;gt;
&amp;lt;/Target&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;SPAN&gt;Second, you would need to change&lt;/SPAN&gt;&lt;/DIV&gt;&lt;LI-CODE lang="markup"&gt;var baseDir = AppContext.BaseDirectory;&lt;/LI-CODE&gt;&lt;DIV&gt;&lt;SPAN&gt;to&lt;/SPAN&gt;&lt;/DIV&gt;&lt;LI-CODE lang="markup"&gt;var baseDir = Path.GetDirectoryName(System.Environment.ProcessPath);&lt;/LI-CODE&gt;&lt;DIV&gt;&lt;SPAN&gt;in Program.cs&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;as &lt;/SPAN&gt;&lt;SPAN&gt;AppContext.BaseDirectory&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;will point to the temp folder where the assemblies are extracted, not to the folder with the .exe itself.&lt;/SPAN&gt;&lt;/DIV&gt;</description>
    <pubDate>Wed, 07 Jan 2026 18:34:52 GMT</pubDate>
    <dc:creator>imalcolm_esri</dc:creator>
    <dc:date>2026-01-07T18:34:52Z</dc:date>
    <item>
      <title>Single-file deployment failed</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/single-file-deployment-failed/m-p/1676261#M13838</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I built a&lt;A href="https://learn.microsoft.com/en-us/dotnet/core/deploying/single-file/overview?tabs=cli" target="_self"&gt; single-file executable i&lt;/A&gt;n .NET with the following command for &lt;A href="https://github.com/owari-taro/MyArcSample/blob/master/Hello.csproj" target="_self"&gt;my application using ArcGIS Runtime.&lt;/A&gt;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;dotnet publish -r win-x64&lt;/LI-CODE&gt;&lt;P&gt;But I can’t run the generated .exe&amp;nbsp; with the following error message:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;&amp;gt;Hello.exe
Unhandled exception. System.TypeInitializationException: The type initializer for 'Esri.ArcGISRuntime.Geometry.SpatialReferences' threw an exception.
 ---&amp;gt; System.InvalidOperationException: Invalid Wkid value (3857) creating a SpatialReference.
 ---&amp;gt; System.TypeInitializationException: The type initializer for 'RuntimeCoreNet.GeneratedWrappers.CoreSpatialReference' threw an exception.
 ---&amp;gt; System.DllNotFoundException: Dll was not found.
   at RuntimeCoreNet.GeneratedWrappers.CoreArcGISRuntimeEnvironment.&amp;lt;CoreRT_ArcGISRuntimeEnvironment_setInstallDirectory&amp;gt;g____PInvoke|69_0(Byte* __installPath_native, IntPtr* __outErrorHandle_native)
   at RuntimeCoreNet.GeneratedWrappers.CoreArcGISRuntimeEnvironment.&amp;lt;CoreRT_ArcGISRuntimeEnvironment_setInstallDirectory&amp;gt;g____PInvoke|69_0(Byte* __installPath_native, IntPtr* __outErrorHandle_native)
   at RuntimeCoreNet.GeneratedWrappers.CoreArcGISRuntimeEnvironment.CoreRT_ArcGISRuntimeEnvironment_setInstallDirectory(String installPath, IntPtr* outErrorHandle)
   at RuntimeCoreNet.GeneratedWrappers.CoreArcGISRuntimeEnvironment.SetInstallDirectory(String installPath)
   at Esri.ArcGISRuntime.ArcGISRuntimeEnvironment.InitNative()
   at Esri.ArcGISRuntime.ArcGISRuntimeEnvironment.InitializeRuntimeCore()
   at Esri.ArcGISRuntime.ArcGISRuntimeEnvironment.Initialize()
   at Esri.ArcGISRuntime.ArcGISRuntimeEnvironment.OnBeforeFirstUseOfGeneratedWrapper()
   at RuntimeCoreNet.GeneratedWrappers.CoreSpatialReference..cctor()
   --- End of inner exception stack trace ---
   at RuntimeCoreNet.GeneratedWrappers.CoreSpatialReference..ctor(Int32 wkid)
   at Esri.ArcGISRuntime.Geometry.SpatialReference.CreateCoreCheckParams(Int32 wkid, Int32 vertId)
   --- End of inner exception stack trace ---
   at Esri.ArcGISRuntime.Geometry.SpatialReference.CreateCoreCheckParams(Int32 wkid, Int32 vertId)
   at Esri.ArcGISRuntime.Geometry.SpatialReference.GetFromCache(Int32 wkid, Int32 verticalWkid)
   at Esri.ArcGISRuntime.Geometry.SpatialReference.Create(Int32 wkid, Int32 verticalWkid)
   at Esri.ArcGISRuntime.Geometry.SpatialReferences..cctor()
   --- End of inner exception stack trace ---
   at Esri.ArcGISRuntime.Geometry.SpatialReferences.get_Wgs84()
   at Hello.Program.Main() in C:\Users\*******\source\repos\MyArcSample\Program.cs:line 14
   at Hello.Program.&amp;lt;Main&amp;gt;()&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;On the other hand, the executable produced by &lt;STRONG&gt;Build &amp;gt; Build {projectname}&lt;/STRONG&gt; runs successfully.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I’m wondering if I’m missing some configuration for the single-file build.&lt;BR /&gt;Do you have any ideas or hints on what could be causing this?&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;&amp;lt;Project Sdk="Microsoft.NET.Sdk"&amp;gt;

  &amp;lt;PropertyGroup&amp;gt;
    &amp;lt;OutputType&amp;gt;Exe&amp;lt;/OutputType&amp;gt;
    &amp;lt;TargetFramework&amp;gt;net10.0&amp;lt;/TargetFramework&amp;gt;
    &amp;lt;ImplicitUsings&amp;gt;enable&amp;lt;/ImplicitUsings&amp;gt;
    &amp;lt;Nullable&amp;gt;enable&amp;lt;/Nullable&amp;gt;
    &amp;lt;DefaultItemExcludes&amp;gt;$(DefaultItemExcludes);tests\**\*;tests/**\*&amp;lt;/DefaultItemExcludes&amp;gt;
    &amp;lt;PublishSingleFile&amp;gt;true&amp;lt;/PublishSingleFile&amp;gt;
    &amp;lt;SelfContained&amp;gt;true&amp;lt;/SelfContained&amp;gt;
   &amp;lt;IncludeNativeLibrariesForSelfExtract&amp;gt;true&amp;lt;/IncludeNativeLibrariesForSelfExtract&amp;gt;
   &amp;lt;Platforms&amp;gt;AnyCPU;x64;x64&amp;lt;/Platforms&amp;gt;

  &amp;lt;/PropertyGroup&amp;gt;

  &amp;lt;ItemGroup&amp;gt;
    &amp;lt;PackageReference Include="Esri.ArcGISRuntime" Version="200.8.0" /&amp;gt;
  &amp;lt;/ItemGroup&amp;gt;

  &amp;lt;!-- Copy shapefile components from the data folder to output and publish directories --&amp;gt;
  &amp;lt;ItemGroup&amp;gt;
    &amp;lt;None Include="data\**\*.shp" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" /&amp;gt;
    &amp;lt;None Include="data\**\*.dbf" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" /&amp;gt;
    &amp;lt;None Include="data\**\*.shx" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" /&amp;gt;
    &amp;lt;None Include="data\**\*.prj" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" /&amp;gt;
    &amp;lt;None Include="data\**\*.cpg" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" /&amp;gt;
  &amp;lt;/ItemGroup&amp;gt;

&amp;lt;/Project&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jan 2026 08:28:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/single-file-deployment-failed/m-p/1676261#M13838</guid>
      <dc:creator>TaroShibata</dc:creator>
      <dc:date>2026-01-07T08:28:57Z</dc:date>
    </item>
    <item>
      <title>Re: Single-file deployment failed</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/single-file-deployment-failed/m-p/1676434#M13842</link>
      <description>&lt;DIV&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;SPAN&gt;It looks like you'll need to add&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;lt;IncludeAllContentForSelfExtract&amp;gt;True&amp;lt;/IncludeAllContentForSelfExtract&amp;gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;to the project file. You can replace&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;IncludeNativeLibrariesForSelfExtract&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;since &lt;/SPAN&gt;&lt;SPAN&gt;IncludeAllContentForSelfExtract&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;should cover the same functionality. More info here: &lt;A href="https://learn.microsoft.com/en-us/dotnet/core/deploying/single-file/overview?tabs=vs#native-libraries" target="_self"&gt;https://learn.microsoft.com/en-us/dotnet/core/deploying/single-file/overview?tabs=vs#native-libraries&lt;/A&gt;.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;SPAN&gt;By default setting &lt;/SPAN&gt;&lt;SPAN&gt;IncludeAllContentForSelfExtract&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;will bundle the shapefile data specified in the &lt;/SPAN&gt;&lt;SPAN&gt;ItemGroup&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;and extract it to a temp folder at runtime. To return to the original behavior where you modify files in the same folder as the .exe file, a couple of changes are needed. First, you would replace the &lt;/SPAN&gt;&lt;SPAN&gt;ItemGroup&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;with a &lt;/SPAN&gt;&lt;SPAN&gt;Target&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;to copy the data manually like the following:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;Target Name="CopyShapefiles" AfterTargets="Build;Publish"&amp;gt;
    &amp;lt;ItemGroup&amp;gt;
        &amp;lt;ShapefileComponents Include="data\**\*.shp;data\**\*.dbf;data\**\*.shx;data\**\*.prj;data\**\*.cpg" /&amp;gt;
    &amp;lt;/ItemGroup&amp;gt;
    &amp;lt;!-- Copy to output directory (for when building without publishing) --&amp;gt;
    &amp;lt;Copy SourceFiles="@(ShapefileComponents)"
          DestinationFolder="$(OutputPath)%(RelativeDir)"
          SkipUnchangedFiles="true" /&amp;gt;
    &amp;lt;!-- Copy to publish directory (only applies to published builds) --&amp;gt;
    &amp;lt;Copy SourceFiles="@(ShapefileComponents)"
          DestinationFolder="$(PublishDir)%(RelativeDir)"
          SkipUnchangedFiles="true" /&amp;gt;
&amp;lt;/Target&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;SPAN&gt;Second, you would need to change&lt;/SPAN&gt;&lt;/DIV&gt;&lt;LI-CODE lang="markup"&gt;var baseDir = AppContext.BaseDirectory;&lt;/LI-CODE&gt;&lt;DIV&gt;&lt;SPAN&gt;to&lt;/SPAN&gt;&lt;/DIV&gt;&lt;LI-CODE lang="markup"&gt;var baseDir = Path.GetDirectoryName(System.Environment.ProcessPath);&lt;/LI-CODE&gt;&lt;DIV&gt;&lt;SPAN&gt;in Program.cs&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;as &lt;/SPAN&gt;&lt;SPAN&gt;AppContext.BaseDirectory&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;will point to the temp folder where the assemblies are extracted, not to the folder with the .exe itself.&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 07 Jan 2026 18:34:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/single-file-deployment-failed/m-p/1676434#M13842</guid>
      <dc:creator>imalcolm_esri</dc:creator>
      <dc:date>2026-01-07T18:34:52Z</dc:date>
    </item>
    <item>
      <title>Re: Single-file deployment failed</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/single-file-deployment-failed/m-p/1676619#M13844</link>
      <description>&lt;P&gt;Thanks for your help — that solved my issue.&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/800101"&gt;@imalcolm_esri&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jan 2026 08:49:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/single-file-deployment-failed/m-p/1676619#M13844</guid>
      <dc:creator>TaroShibata</dc:creator>
      <dc:date>2026-01-08T08:49:38Z</dc:date>
    </item>
  </channel>
</rss>

