我刚刚安装了ASP。. NET Core从微软网站,但当我试图运行我的应用程序(./Web
)我得到以下错误信息:
root@stm32mp1:/usr/local/Monitoring/Web# ./Web
It was not possible to find any compatible framework version
The framework 'Microsoft.AspNetCore.App', version '3.1.0' was not found.
- No frameworks were found.
You can resolve the problem by installing the specified framework and/or SDK.
The specified framework can be found at:
- https://aka.ms/dotnet-core-applaunch?framework=Microsoft.AspNetCore.App&framework_version=3.1.0&arch=arm&rid=openstlinux-weston.3.1-openstlinux-5-4-dunfell-mp1-20-11-12-arm
但是当我运行dotnet --list-runtimes
时,它告诉我运行时设置正确:
root@stm32mp1:/usr/local/Monitoring/Web# dotnet --list-runtimes
Microsoft.AspNetCore.App 3.1.0 [/usr/local/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.0 [/usr/local/dotnet/shared/Microsoft.NETCore.App]
以下是dotnet --info
命令的结果:
root@stm32mp1:/usr/local/Monitoring/Web# dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 3.1.100
Commit: cd82f021f4
Runtime Environment:
OS Name: openstlinux-weston
OS Version: 3.1-openstlinux-5-4-dunfell-mp1-20-11-12
OS Platform: Linux
RID: linux-arm
Base Path: /usr/local/dotnet/sdk/3.1.100/
Host (useful for support):
Version: 3.1.0
Commit: 65f04fb6db
.NET Core SDKs installed:
3.1.100 [/usr/local/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.App 3.1.0 [/usr/local/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.0 [/usr/local/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
我的路径设置正确:
root@stm32mp1:/usr/local/Monitoring/Web# echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/dotnet
我尝试了以下ARM32二进制文件:
- SDK 3.1.406
- ASP。Core Runtime 3.1.12
- SDK 3.1.100
- ASP。Core Runtime 3.1.0
- 两个SDK/runtime组合
但是什么都不起作用!
为获取信息,我从STM和openstlinux-weston(从Yoctoproject生成)在ARM32 A7处理器上运行此命令以前,执行这个项目作为框架依赖的工作,但现在我只能运行它作为自包含的,但我有很多项目,而不是那么多的空间....
希望有足够的信息来解决这个问题。
看起来这是Visual studio发布过程中的问题。因此,我按照以下步骤重新开始配置我的所有项目:
清理了我的每个.csproj
,因此调试/发布配置如下所示
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<Configurations>Release;Debug</Configurations>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>TRACE;Windows</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DefineConstants>TRACE;Linux</DefineConstants>
<RuntimeIdentifier>linux-arm</RuntimeIdentifier>
</PropertyGroup>
<!-- ... -->
Redonne所有项目的发布配置文件所以它看起来像这样:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<PublishProvider>FileSystem</PublishProvider>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<ProjectGuid>a3c8bed8-1269-4649-8573-ff4fb864100b</ProjectGuid>
<publishUrl>binReleasenetcoreapp3.1linux-armpublish</publishUrl>
<DeleteExistingFiles>False</DeleteExistingFiles>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RuntimeIdentifier>linux-arm</RuntimeIdentifier>
<SelfContained>false</SelfContained>
</PropertyGroup>
</Project>
/bin
和/obj
文件夹。最后,再次发布,它工作了!.
我重命名了我所有的项目配置(发布/调试)多次,所以可能visual studio搞砸了不同的目录和发布错误的文件到目标Linux平台。希望它能帮助到有同样问题的人。