A fatal error occurred the required library hostfxr dll could not be found

When I run my WPF application on other computers it throws me this error: Description: A .NET Core application failed. Application: program.exe Path: C:fakepathprogram.exe Message: A fatal error

When I run my WPF application on other computers it throws me this error:

Description: A .NET Core application failed.
Application: program.exe
Path: C:fakepathprogram.exe
Message: A fatal error occurred. The required library hostfxr.dll could not be found.
If this is a self-contained application, that library should exist in 
[C:fakepath].
If this is a framework-dependent application, install the runtime in the global location [C:Program 
Filesdotnet] or use the DOTNET_ROOT environment variable to specify the runtime location or 
register the runtime location in [HKLMSOFTWAREdotnetSetupInstalledVersionsx64InstallLocation].

Add library runtime 3.1.0 it help me.

asked Dec 11, 2019 at 11:32

Silny ToJa's user avatar

Silny ToJaSilny ToJa

1,6271 gold badge5 silver badges15 bronze badges

1

Further to Ajith’s answer, «Deployment Mode: Self Contained» can also be selected in Visual Studio 2019 here:

GUI in Visual Studio

answered Apr 15, 2020 at 15:03

matt_w's user avatar

matt_wmatt_w

1,0868 silver badges8 bronze badges

5

I got the same error for my .Net core 3.0 app today. This is because you are missing the .net core run time in the machine, and is installing a framework dependent application.

The solution for this is to publish the application with Deployment Mode Self Contained.

Use the below command to publish from command line

dotnet publish -c Release -r <RID> --self-contained true

get the RID details from https://learn.microsoft.com/en-us/dotnet/core/rid-catalog#windows-rids

answered Dec 13, 2019 at 12:11

Ajith's user avatar

AjithAjith

1,3972 gold badges16 silver badges31 bronze badges

1

As from the error message, if this is a framework-dependent application :

If this is a framework-dependent application, install the runtime in the global location [C:Program 
Filesdotnet] or use the DOTNET_ROOT environment variable to specify the runtime location or 
register the runtime location in [HKLMSOFTWAREdotnetSetupInstalledVersionsx64InstallLocation].

Please set the DOTNET_ROOT environment to one of the following locations, depending upon where you have installed dotnet.exe

C:Program Filesdotnet OR C:Program Files (x86)dotnet

from «My Computer | Properties | Advanced | Environment Variables». Now restart your IDE/Terminal whatever you are using.

answered Apr 27, 2020 at 6:46

Jitender Kumar's user avatar

Jitender KumarJitender Kumar

2,3194 gold badges29 silver badges42 bronze badges

1

For some weird reason .net publisher failed to publish self-contained .Net Core 3 application (console app). I’ve solved this just installing .Net Core 3 Runtime on the server.

answered Aug 31, 2020 at 8:03

Saulius's user avatar

SauliusSaulius

1,59619 silver badges29 bronze badges

I ended up on this page many times in my search for a solution to my problem.

My self contained exe was raising the error

Could not load file or assembly 'System.Data.SqlClient, Version=4.6.1.1

I was publishing the .net core 3.1 runtime and referencing a netstandard library that referenced System.Data.SqlClient, Version=4.6.1.1

The following git hub page has this marked as a known issue
https://github.com/dotnet/core/blob/master/release-notes/3.1/3.1-known-issues.md#net-core-312

Setting our exe to publish the .net core 3.0 runtime fixed this for us.
We have control of the referenced library so will probably follow the advice on the github page but for anyone else that has not got control of library may find this of use.

answered Jun 26, 2020 at 13:13

sidcom's user avatar

sidcomsidcom

1111 silver badge8 bronze badges

EntityFrameWork Core has been moved out of the dotnet sdk you need to install dependency globally check progr C:Users»Your User Name».dotnettools.storedotnet-ef3.1.5 if it was present you have sucessfully installed EFcore globally and make sure your project level Ef Core dependency version matching with globally installed EFcore version …..if there is a mismatch it will trow above error…if you uninstalled make sure you are deleting the above path folder C:Users»Your User Name».dotnet and again reinstalling….It will Worked for me

answered Aug 12, 2020 at 15:05

ABHISHEK N's user avatar

A fatal error occured. The required library hostfxr.dll could not be found

Today in this article, we will cover below aspects,

  • Issue Description
  • Resolution
  • Resolution 1 – Build Application as FDD(Framework dependent deployment)
  • hostfxr.dll location
  • Resolution 2 – Build Application as Self Content Deployment
  • hostfxr.dll location

Issue Description

The application throws the below error in the runtime,

A fatal error occurred. The required library hostfxr.dll could not be found

A fatal error occured The required library hostfxrdll could not be found 1

Resolution

The issue I found to be due to the .NET runtime not being available in the target machine.

There could be few basic reasons for the error. Generally, developers tend to deploy the application in a new environment assuming it will work as-is.

When installing the application to the new environment, if the target machine has the required .NET version already installed then the application should work without any issue.

If the required .NET core SDK/runtime is not installed then one can follow any of the below approaches discussed. An approach using Self-content deployment doesn’t require a .NET Core SDK/Runtime to be installed on the target machines.

Let’s see both the approaches in detail,

Resolution 1 – Build Application as FDD(Framework dependent deployment)

If you are building an application using an approach called Framework dependent deployment (FDC) approach, then it is expected that the target server or environment has the .NET Core SDK and runtime installed.

For more details, please refer Self Contained Vs Framework Dependent Deployment

Typically your application supported Runtime/SDK will be available in the below folder on the target machine,

C:Program Filesdotnet

hostfxr.dll location

hostfxr.dll can be found below shared location depending on the target .NET version used,

required library hostfxrdll could not be found
hostfxrdll location

Resolution: Install NET Core on the target machine/environment. Your application will work just fine as a developer machine.

If you want an alternative solution without installing the .NET Core version, please see below,

Resolution 2 – Build Application as Self Content Deployment

If you are building an application using an approach, then you make sure the application deployable is self-content and can run on its own.

For more details, please refer Self Contained Vs Framework Dependent Deployment

This can be achieved by building your application using the below build command,

For Linux

dotnet publish -r linux-x64 --self-contained true -c release

For Windows10

dotnet publish -r win10-x64 --self-contained true -c release

OR

For Windows Server

dotnet publish -r win-x64 --self-contained true -c release

With this approach, you achieve the below advantage,

  • App doesn’t required to download and install. NET.
  • Application is isolated from other .NET apps
  • Application doesnt use a locally installed shared runtime if available
  • You are able to control whcih target version you want to use.

The user of your app isn’t required to download and install. NET.

With the above-discussed approaches, you should be all set to run your application without any issues.

hostfxr.dll location

Missing hostfxr.dll can be found in the publish target folder along with the other binaries.

hostfxr

References:

  • Create Self Contained Single Executable (EXE) in .NET Core
  • Self Contained Vs Framework Dependent Deployment -Guidelines

Did I miss anything else in these resolution steps?

Did the above steps resolve your issue? Please sound off your comments below!

Happy Coding !!


Please bookmark this page and share it with your friends. Please Subscribe to the blog to get a notification on freshly published best practices and guidelines for software design and development.


Problem

You are trying to run a .NET executable and you get the following error:

A fatal error occurred. The required library hostfxr.dll could not be found.
If this is a self-contained application, that library should exist in [C:MyApp].
If this is a framework-dependent application, install the runtime in the global location [C:Program Filesdotnet] or use the DOTNET_ROOT environment variable to specify the runtime location or register the runtime location in [HKLMSOFTWAREdotnetSetupInstalledVersionsx64InstallLocation].

The .NET runtime can be found here: <hopefully a helpful URL to a specific .NET version>

This means you need to install .NET.

Another symptom of this is when you try to start the app directly (instead of starting it from the command line), it closes immediately. I suggest starting the app from the command line to confirm the error.

Solution

You have two choices for installing .NET:

  • Install the specific .NET runtime your app needs (console, desktop, or ASP.NET Core).

-or-

  • Install the .NET SDK. This contains all of the runtimes (+ tools for development).

In most cases, I’d suggest installing the .NET SDK. Here are the .NET SDK download pages for a few versions:

  • .NET Core 3.1 SDK
  • .NET 5 SDK
  • .NET 6 SDK
  • .NET latest SDK (so this list is future-proofed!)

Which .NET version?

Be sure to pick the right .NET version that your app needs. Otherwise you’ll get another error message like: It was not possible to find any compatible framework version.

These error messages usually have a URL at the bottom with the right .NET version you need. However, you can find this information yourself by looking in the .runtimeconfig file. Let’s say your app is called MyApp.exe. Look in MyApp.runtimeconfig for the framework version. For example, here’s an ASP.NET Core app running in .NET 5:

{ "runtimeOptions": { "tfm": "net5.0", "framework": { "name": "Microsoft.AspNetCore.App", "version": "5.0.0" }, "configProperties": { "System.GC.Server": true, "System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false } } }

Code language: JSON / JSON with Comments (json)

User-53724977 posted

I would like to utilise Entity Framework Core in order to create my web application database schema and other migrations features.

Since it is no longer shipped as an integral part of the .NET framework, I decided to install it using the command<sup>1</sup>:

dotnet tool install --global dotnet-ef

I receive the prompt thinking it is successfully installed and that I may interact with it in the console:

You can invoke the tool using the following command: dotnet-ef Tool ‘dotnet-ef’ (version ‘5.0.5’) was successfully installed.

As above, I am told I «can invoke» the tool and that it is «successfully» installed. But when invoking the command dotnet-ef, I find that I can not invoke the tool and that it is not successfully
installed as I receive the error message<sup>2</sup>:

A fatal error occurred. The required library hostfxr.dll could not be found. If this is a self-contained application, that library should exist in [C:UsersDejanP.dotnettools.storedotnet- ef5.0.5dotnet-ef5.0.5toolsnetcoreapp3.1any]. If this is a
framework-dependent application, install the runtime in the global location [C:Program Filesdotnet] or use the DOTNET_ROOT environment variable to specify the runtime locat

The .NET Core runtime can be found at:

  • https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=x64&rid=win10-x64

I have two comments on this prompt:

  1. Upon inspection, there indeed is not file of that name in the stated directory. Upon searching however, I do find such a file in the directory:

    C:UsersDejanP.dotnethostfxr5.0.5

  2. I can’t begin to action the hints in the prompt as I don’t know if my application is self-contained or framework-dependent

I would be tremendously grateful if someone could assist whilst noting my specific environment:

  • Op System: MS Windows 10 Pro, version 1709, OS Build 16299.1087
  • IDE: Jet Brains Rider 2021.1.2
  • .NET environment: .NET Core
  • .NET version: 5.0.202
  • Application that I am building: ASP.NET Core Web Application
    (Model-View-Controller)

The jargon I have used may come across as if I am verse in this tech stack but I am very new to all this and would appreciate some guidance using first principles and the assumption that I know almost nothing.

Скачать сейчас

Ваша операционная система:

Как исправить ошибку Hostfxr.dll?

Прежде всего, стоит понять, почему hostfxr.dll файл отсутствует и почему возникают hostfxr.dll ошибки. Широко распространены ситуации, когда программное обеспечение не работает из-за недостатков в .dll-файлах.


What is a DLL file, and why you receive DLL errors?

DLL (Dynamic-Link Libraries) — это общие библиотеки в Microsoft Windows, реализованные корпорацией Microsoft. Файлы DLL не менее важны, чем файлы с расширением EXE, а реализовать DLL-архивы без утилит с расширением .exe просто невозможно.:


Когда появляется отсутствующая ошибка Hostfxr.dll?

Если вы видите эти сообщения, то у вас проблемы с Hostfxr.dll:

  • Программа не запускается, потому что Hostfxr.dll отсутствует на вашем компьютере.
  • Hostfxr.dll пропала.
  • Hostfxr.dll не найдена.
  • Hostfxr.dll пропала с вашего компьютера. Попробуйте переустановить программу, чтобы исправить эту проблему.
  • «Это приложение не запустилось из-за того, что Hostfxr.dll не была найдена. Переустановка приложения может исправить эту проблему.»

Но что делать, когда возникают проблемы при запуске программы? В данном случае проблема с Hostfxr.dll. Вот несколько способов быстро и навсегда устранить эту ошибку.:


метод 1: Скачать Hostfxr.dll и установить вручную

Прежде всего, вам нужно скачать Hostfxr.dll на ПК с нашего сайта.

  • Скопируйте файл в директорию установки программы после того, как он пропустит DLL-файл.
  • Или переместить файл DLL в директорию вашей системы (C:WindowsSystem32, и на 64 бита в C:WindowsSysWOW64).
  • Теперь нужно перезагрузить компьютер.

Если этот метод не помогает и вы видите такие сообщения — «hostfxr.dll Missing» или «hostfxr.dll Not Found,» перейдите к следующему шагу.

Hostfxr.dll Версии

Версия

биты

Компания

Язык

Размер

3.0.19.46305

64 bit

Microsoft Corporation

U.S. English

0.57 MB

Версия

биты

Компания

Язык

Размер

3.0.19.46305

32 bit

Microsoft Corporation

U.S. English

0.45 MB

Версия

биты

Компания

Язык

Размер

2.2.27207.3

64 bit

Microsoft Corporation

U.S. English

0.38 MB


метод 2: Исправление Hostfxr.dll автоматически с помощью инструмента для исправления ошибок

Как показывает практика, ошибка вызвана непреднамеренным удалением файла Hostfxr.dll, что приводит к аварийному завершению работы приложений. Вредоносные программы и заражения ими приводят к тому, что Hostfxr.dll вместе с остальными системными файлами становится поврежденной.

Вы можете исправить Hostfxr.dll автоматически с помощью инструмента для исправления ошибок! Такое устройство предназначено для восстановления поврежденных/удаленных файлов в папках Windows. Установите его, запустите, и программа автоматически исправит ваши Hostfxr.dll проблемы.

Если этот метод не помогает, переходите к следующему шагу.


метод
3: Установка или переустановка пакета Microsoft Visual C ++ Redistributable Package

Ошибка Hostfxr.dll также может появиться из-за пакета Microsoft Visual C++ Redistribtable Package. Необходимо проверить наличие обновлений и переустановить программное обеспечение. Для этого воспользуйтесь поиском Windows Updates. Найдя пакет Microsoft Visual C++ Redistributable Package, вы можете обновить его или удалить устаревшую версию и переустановить программу.

  • Нажмите клавишу с логотипом Windows на клавиатуре — выберите Панель управления — просмотрите категории — нажмите на кнопку Uninstall.
  • Проверить версию Microsoft Visual C++ Redistributable — удалить старую версию.
  • Повторить деинсталляцию с остальной частью Microsoft Visual C++ Redistributable.
  • Вы можете установить с официального сайта Microsoft третью версию редистрибутива 2015 года Visual C++ Redistribtable.
  • После загрузки установочного файла запустите его и установите на свой ПК.
  • Перезагрузите компьютер после успешной установки.

Если этот метод не помогает, перейдите к следующему шагу.


метод
4: Переустановить программу

Как только конкретная программа начинает давать сбой из-за отсутствия .DLL файла, переустановите программу так, чтобы проблема была безопасно решена.

Если этот метод не помогает, перейдите к следующему шагу.


метод
5: Сканируйте систему на наличие вредоносного ПО и вирусов

System File Checker (SFC) — утилита в Windows, позволяющая пользователям сканировать системные файлы Windows на наличие повреждений и восстанавливать их. Данное руководство описывает, как запустить утилиту System File Checker (SFC.exe) для сканирования системных файлов и восстановления отсутствующих или поврежденных системных файлов (включая файлы .DLL). Если файл Windows Resource Protection (WRP) отсутствует или поврежден, Windows может вести себя не так, как ожидалось. Например, некоторые функции Windows могут не работать или Windows может выйти из строя. Опция «sfc scannow» является одним из нескольких специальных переключателей, доступных с помощью команды sfc, команды командной строки, используемой для запуска System File Checker. Чтобы запустить её, сначала откройте командную строку, введя «командную строку» в поле «Поиск», щелкните правой кнопкой мыши на «Командная строка», а затем выберите «Запустить от имени администратора» из выпадающего меню, чтобы запустить командную строку с правами администратора. Вы должны запустить повышенную командную строку, чтобы иметь возможность выполнить сканирование SFC.

  • Запустите полное сканирование системы за счет антивирусной программы. Не полагайтесь только на Windows Defender. Лучше выбирать дополнительные антивирусные программы параллельно.
  • После обнаружения угрозы необходимо переустановить программу, отображающую данное уведомление. В большинстве случаев, необходимо переустановить программу так, чтобы проблема сразу же исчезла.
  • Попробуйте выполнить восстановление при запуске системы, если все вышеперечисленные шаги не помогают.
  • В крайнем случае переустановите операционную систему Windows.

В окне командной строки введите «sfc /scannow» и нажмите Enter на клавиатуре для выполнения этой команды. Программа System File Checker запустится и должна занять некоторое время (около 15 минут). Подождите, пока процесс сканирования завершится, и перезагрузите компьютер, чтобы убедиться, что вы все еще получаете ошибку «Программа не может запуститься из-за ошибки Hostfxr.dll отсутствует на вашем компьютере.


метод 6: Использовать очиститель реестра

Registry Cleaner — мощная утилита, которая может очищать ненужные файлы, исправлять проблемы реестра, выяснять причины медленной работы ПК и устранять их. Программа идеально подходит для работы на ПК. Люди с правами администратора могут быстро сканировать и затем очищать реестр.

  • Загрузите приложение в операционную систему Windows.
  • Теперь установите программу и запустите ее. Утилита автоматически очистит и исправит проблемные места на вашем компьютере.

Если этот метод не помогает, переходите к следующему шагу.


Frequently Asked Questions (FAQ)

QКакая последняя версия файла hostfxr.dll?

A3.0.19.46305 — последняя версия hostfxr.dll, доступная для скачивания

QКуда мне поместить hostfxr.dll файлы в Windows 10?

Ahostfxr.dll должны быть расположены в системной папке Windows

QКак установить отсутствующую hostfxr.dll

AПроще всего использовать инструмент для исправления ошибок dll


Основные причины ошибок DLL, связанных с hostfxr.dll, включают отсутствие или повреждение файла DLL RoboHelp Office 2019 WIN ESD ALL, или, в некоторых случаях, заражение вредоносным ПО. Обычно, установка новой версии файла DLL позволяет устранить проблему, из-за которой возникает ошибка. Помимо прочего, в качестве общей меры по профилактике и очистке мы рекомендуем использовать очиститель реестра для очистки любых недопустимых записей файлов, расширений файлов DLL или разделов реестра, что позволит предотвратить появление связанных с ними сообщений об ошибках.

Типы Системные файлы, которые используют DLL, также известны в качестве формата Dynamic Link Library. Наша коллекция файлов hostfxr.dll для %%os%% представлена в списках ниже. Если в настоящий момент отсутствует необходимая вам версия hostfxr.dll, запросите ей, нажав на кнопку Request (Запрос) рядом с необходимой версией файла. В некоторых случаях, чтобы получить необходимую версию файла, вам может потребоваться связаться непосредственно с Adobe.

Как правило, ошибки подобного типа больше не возникают после размещения надлежащей версии файла hostfxr.dll в соответствующем месте, однако вам следует выполнить проверку ещё раз. Мы рекомендуем повторно запустить RoboHelp Office 2019 WIN ESD ALL для проверки того, возникает ли проблема.

Hostfxr.dll Описание файла
Расширение файла: DLL
Категория: Documentation,Editor,Help Desk,Tool
Новейшие программы: RoboHelp Office 2019 WIN ESD ALL
Вер: 14.0
Компания: Adobe
 
File: hostfxr.dll  

KB: 319984
SHA-1: 5be26664ec1ed6a702b9c83f938b739f213d6395
MD5: f4462435afe1ac5d8ca9afcbb3a00d35
CRC32: e988abfe

Продукт Solvusoft

Загрузка
WinThruster 2023 — Сканировать ваш компьютер на наличие ошибок реестра в hostfxr.dll

Windows
11/10/8/7/Vista/XP

Установить необязательные продукты — WinThruster (Solvusoft) | Лицензия | Политика защиты личных сведений | Условия | Удаление

DLL
hostfxr.dll

Идентификатор статьи:   526249

Hostfxr.dll

File Контрольная сумма MD5 Байт Загрузить
+ hostfxr.dll f4462435afe1ac5d8ca9afcbb3a00d35 312.48 KB
Application RoboHelp Office 2019 WIN ESD ALL 14.0
Разработчик Adobe
Вер Windows 10
Тип 64-разрядная (x64)
Размер 319984
Контрольная сумма MD5 f4462435afe1ac5d8ca9afcbb3a00d35
ША1 5be26664ec1ed6a702b9c83f938b739f213d6395
CRC32: e988abfe
каталог C:WindowsSystem32

Классические проблемы Hostfxr.dll

Усложнения RoboHelp Office 2019 WIN ESD ALL с hostfxr.dll состоят из:

  • «Hostfxr.dll не может быть найден. «
  • «Отсутствует hostfxr.dll. «
  • «Hostfxr.dll нарушение прав доступа.»
  • «Файл hostfxr.dll не удалось зарегистрировать.»
  • «Файл C:WindowsSystem32\hostfxr.dll не найден.»
  • «Не могу запустить RoboHelp Office 2019 WIN ESD ALL. Отсутствует компонент hostfxr.dll. Переустановите RoboHelp Office 2019 WIN ESD ALL. «
  • «Не удалось выполнить приложение, так как hostfxr.dll не найден. Повторная установка RoboHelp Office 2019 WIN ESD ALL может решить проблему. «

Обычно ошибки hostfxr.dll с RoboHelp Office 2019 WIN ESD ALL возникают во время запуска или завершения работы, в то время как приложения, связанные с hostfxr.dll, выполняются, или редко во время последовательности обновления ОС. Документирование случаев проблем hostfxr.dll в RoboHelp Office 2019 WIN ESD ALL является ключевым для определения причины проблем с электронной Documentation,Editor,Help Desk,Tool и сообщения о них Adobe.

Корень проблем Hostfxr.dll

Поврежденные и отсутствующие файлы hostfxr.dll создают большинство ошибок, связанных с hostfxr.dll. Поскольку hostfxr.dll является внешним файлом, он предоставляет прекрасную возможность для чего-то нежелательного.

Файлы hostfxr.dll повреждены от вредоносных программ, плохих отключений (ОС или RoboHelp Office 2019 WIN ESD ALL) и других сценариев, связанных с hostfxr.dll. При загрузке RoboHelp Office 2019 WIN ESD ALL поврежденный hostfxr.dll не может загружаться должным образом, вызывая сбои.

Кроме того проблемы hostfxr.dll вызваны плохими ссылками, связанными с RoboHelp Office 2019 WIN ESD ALLs в реестре Windows. Эти разбитые ссылки на пути hostfxr.dll вызывают ошибки с RoboHelp Office 2019 WIN ESD ALL из-за неправильной регистрации hostfxr.dll. Эти сломанные разделы реестра могут быть в результате отсутствия DLL-файла, перемещенного DLL-файла или оставшейся ссылки на DLL-файл в реестре Windows после неудачной установки или удаления программного обеспечения.

В первую очередь, проблемы с hostfxr.dll, созданные:

  • Ошибочные или поврежденные записи реестра для hostfxr.dll
  • Вирус или вредоносное ПО поврежден hostfxr.dll.
  • Аппаратный сбой, связанный с Adobe, например видеокарта, повреждает hostfxr.dll.
  • Требуется версия другого программного обеспечения перезаписала версию hostfxr.dll.
  • Другая программа злонамеренно или по ошибке удалила файл hostfxr.dll.
  • hostfxr.dll злонамеренно (или ошибочно) удален другой мошенникой или действительной программой.

Понравилась статья? Поделить с друзьями:
  • A fatal error occurred however mscoree dll could not be loaded to display the appropriate
  • A fatal error occurred failed to connect to espressif device no serial data received
  • A fatal error occurred failed to connect to esp8266 timed out waiting for packet header
  • A fatal error occurred failed to connect to esp32 no serial data received
  • A fatal error occurred failed to connect to esp32 invalid head of packet 0x65