作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
对于 ASP.NET Core,我可以在一个 Project.json 中定位多个框架(例如 netcoreapp1.1
和 dnx451
):
"frameworks": {
"netcoreapp1.1": {
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.1.0",
"type": "platform"
}
},
"imports": [
"dotnet5.6",
"portable-net45+win8"
]
},
"dnx451": {}
},
netcoreapp1.1
或
dnx451
,但我认为无法同时针对两者。
<TargetFramework>netcoreapp1.1;dnx451</TargetFramework>
直接编辑 csproj 文件以添加第二个框架。甚至
<TargetFrameworks>netcoreapp1.1;dnx451</TargetFrameworks>
但由于不受支持的框架而在 Visual Studio 中出现错误。
netcoreapp1.1
和
dnx451
在 Visual Studio 2017 最终版本的一个项目中?
最佳答案
您需要更改一些内容。先是<TargetFrameworks>
标签是多目标的正确标签,;
是分隔符。
DNX 在 RC2 的开发过程中被弃用,因此支持 DNX 的最后一个版本是 RC1。 dnxcore5x
(后来 dotnet5.x
)名字被替换为 netstandard1.x
(对于类库)和 netcoreapp1.x
用于应用程序。 dnx4xx
被整体弃用,net4xx
应该使用。
此外,当您以 .NET Framework 为目标(单独或与 .NET Core/NetStandard 一起)时,您将需要定义一个运行时标识符:
<RuntimeIdentifier>win7-x86</RuntimeIdentifier>
或
<RuntimeIdentifier>win7-x64</RuntimeIdentifier>
或者任何你想成为默认的。
Condition="'$(TargetFramework)' == '<targetmoniker>'
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp1.1'">
<PackageReference Include="Microsoft.NETCore.App">
<Version>1.0.1</Version>
</PackageReference>
</ItemGroup>
否则你可能会收到包恢复错误
关于asp.net-core - 如何在 VS2017 final 中针对多个框架?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42670048/
我是一名优秀的程序员,十分优秀!