Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Superfluous 'runtimes' folder created in output directory for .NET 5 project

I've just migrated a (WPF) .NET 4.6 project to .NET 5.

I've noticed it is now creating a folder called 'runtimes' in the output directory with lots of platform-dependent dlls.

Since this app will only run on Windows machines, is there anyway of preventing these folders being created during a build in Visual Studio?

like image 558
maxp Avatar asked Nov 17 '25 03:11

maxp


1 Answers

That's pretty easy to change: In your csproj file, inside the PropertyGroup, set the SelfContained property to "false" and specify a RuntimeIdentifier; like this:

<PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>net6.0-windows</TargetFramework>
    <Nullable>enable</Nullable>
    <UseWPF>true</UseWPF>
    <SelfContained>false</SelfContained>
    <RuntimeIdentifier>win-x64</RuntimeIdentifier>
</PropertyGroup>
like image 73
user128440 Avatar answered Nov 18 '25 17:11

user128440