我下载了 Visual studio 2022 Final 和 Net6,但是当我创建一个最开始的控制台应用程序时,它构建正常,但是在调试或不调试时它会抛出异常:说:
A fatal error was encountered. The library 'hostpolicy.dll' required to execute the application was not found in 'C:\Program Files\dotnet\'.
Failed to run as a self-contained app.
- The application was run as a self-contained app because 'C:\Users\<UserName>\source\repos\ConsoleApp2022\ConsoleApp2022\bin\Debug\net6.0\ConsoleApp2022.runtimeconfig.json' was not found.
- If this should be a framework-dependent app, add the 'C:\Users\<UserName>\source\repos\ConsoleApp2022\ConsoleApp2022\bin\Debug\net6.0\ConsoleApp2022.runtimeconfig.json' file and specify the appropriate framework.
请任何人为我提供解决此问题的指导。
注意:我做了很多搜索但没有找到任何解决方案,并且解决方案是针对以前的net core
尝试添加一些命令行选项,例如:
--runtimeconfig .\ConsoleApp2022.runtimeconfig.json
--depsfile .\ConsoleApp2022.deps.json