如何在.csproj文件(而不是project.json)中指定ASP.NET Core目标框架导入? [英] How to specify ASP.NET Core target framework imports in .csproj file (instead of project.json)?
问题描述
我正在构建一个ASP.NET Core应用,并试图安装Azure存储软件包。
I'm building an ASP.NET Core app, and am trying to install the Azure Storage package.
在Azure存储github页面上,它说我需要在project.json文件中放置以下内容-但这是因为使用的是最新的ASP.NET Core版本,我们没有project.json文件,只有.csproj文件。
From the Azure Storage github page, it says I need to place the following in my project.json file - but since this is using the latest ASP.NET Core version, we don't have a project.json file, just a .csproj file.
"imports": [
"dnxcore50",
"portable-net451+win8"
]
是有没有办法在.csproj文件中执行此操作?我认为这个地方可能在此附近:
Is there a way to do this in .csproj file? I assume the place might be somewhere around this:
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.1</TargetFramework>
<PreserveCompilationContext>true</PreserveCompilationContext>
</PropertyGroup>
非常感谢!
推荐答案
将我的项目之一迁移到新模型后,它就是这样生成的:
After migrating one of my projects to the new model, this is what it generated:
<PropertyGroup>
<TargetFramework>netcoreapp1.6</TargetFramework>
<PreserveCompilationContext>true</PreserveCompilationContext>
<AssemblyName>TestApp</AssemblyName>
<OutputType>Exe</OutputType>
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.6' ">$(PackageTargetFallback);dotnet5.6;portable-net45+win8</PackageTargetFallback>
</PropertyGroup>
尝试以类似方式添加dnxcore50和Portable-net451 + win8,如下所示:
Try adding dnxcore50 and portable-net451+win8 in a similar fashion, something like this:
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.1</TargetFramework>
<PreserveCompilationContext>true</PreserveCompilationContext>
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.1' ">$(PackageTargetFallback);dnxcore50;portable-net451+win8</PackageTargetFallback>
</PropertyGroup>
这篇关于如何在.csproj文件(而不是project.json)中指定ASP.NET Core目标框架导入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!