如何在.csproj文件(而不是project.json)中指定ASP.NET Core目标框架导入?

编程入门 行业动态 更新时间:2024-10-28 14:33:46
本文介绍了如何在.csproj文件(而不是project.json)中指定ASP.NET Core目标框架导入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在构建一个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目标框架导入?

本文发布于:2023-11-06 22:16:22,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1564819.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:而不是   框架   目标   文件   如何在

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!