0

I'm trying to build an application for release. However, no matter what I do, it needs to have the runtimeconfig.dev.json in the directory, otherwise it won't even run, I get no errors when it does this.

I've tried compiling it so it will produce a single file but then it doesn't work at all even when runtimeconfig.dev.json is included in the directory.

Whilst trying to publish through the interface in Visual Studio the parameters are as followed:

Configuration: release Target Framework: netcoreapp3.1 Target Runtime: win-x64

Also using the dotnet publish -c Release command, this still results in a file dependent on runtime.dev.json

I've also tested the output of the publish on another computer and it just doesn't run at all without any error. Even with the runtimeconfig.dev.json In the directory. Even after changing the framework from 3.1 to 5.0 and then back, it still doesn't work on another computer. I don't understand why as the program works perfectly fine when I run it via visual studio with both the debug and release configurations it's when I'm trying to do it independently is when there is problems.

Here is what my .csproj file looks like.

<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">

  <PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <UseWPF>true</UseWPF>
    <ApplicationIcon>Starter-Edit-Icon.ico</ApplicationIcon>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
    <DocumentationFile></DocumentationFile>
  </PropertyGroup>

  <ItemGroup>
    <Compile Remove="Properties\DataSources\**" />
    <EmbeddedResource Remove="Properties\DataSources\**" />
    <None Remove="Properties\DataSources\**" />
    <Page Remove="Properties\DataSources\**" />
  </ItemGroup>

  <ItemGroup>
    <None Remove="Starter-Edit-Icon.png" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Costura.Fody" Version="5.7.0">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <PackageReference Include="Extended.Wpf.Toolkit" Version="4.1.0" />
  </ItemGroup>

  <ItemGroup>
    <Resource Include="Starter-Edit-Icon.png" />
  </ItemGroup>

</Project>

This is what the runtimeconfig.dev.json file contains

{
  "runtimeOptions": {
    "additionalProbingPaths": [
      "C:\\Users\\MyUserName\\.dotnet\\store\\|arch|\\|tfm|",
      "C:\\Users\\MyUserName\\.nuget\\packages"
    ]
  }
}
David
  • 21
  • 6
  • Does this answer your question? [why .net core self contained app depends on runtimeconfig.dev.json](https://stackoverflow.com/questions/49642318/why-net-core-self-contained-app-depends-on-runtimeconfig-dev-json) – the.Doc Nov 11 '21 at 13:20
  • @the.Doc No, because when I make it self contained it just doesn't even open at all with or without that file in the same directory – David Nov 11 '21 at 13:25

1 Answers1

0

I fixed this issue by removing the unused frameworks from my dependencies, I also uninstalled any NuGet packages that was unused which happened to be both of them I had imported anyway.

David
  • 21
  • 6