.Net Core Library VS2017中的多目标框架
.Net Core Library multiple target frameworks in VS2017
我正在尝试与 Visual Studio 2017 年合作。也许有人也曾与?我暂时找不到太多帮助。
因此,我创建了一个项目 .NET Core
Class Library
。
在 Visual Studio 2015 年,有那些 project.json
文件包含目标框架的信息。
我可以 s.th 像:
"frameworks": {
"netstandard1.5": { ...
},
"netstandard1.6": { ...
},
"netcoreapp1.0": { ...
},
"net45": { ...
},
"net451": { ...
}
} and so on
现在我创建了那个项目,还有那个旧的 *.csproj
xml-文件。
- 是否可以再次使用
json
-文件?
xml使用:
<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
</PropertyGroup>
是否可以在这里添加更多的框架?喜欢 Net45 和 Net451,...?
如果是:如何添加其他(和旧的)依赖项?喜欢 System.Data
?
如果没有:如何在Nuget中使用不同的框架发布一个项目? Copy/Paste 项目和改变一切都没有多大意义,我认为。
Isn't it possible to use the json-file again?
据我所知,我们在Visual Studio 2017年不能使用project.json文件。因为.Net Core将基于msbuild,这意味着它将使用* .csproj 而不是 project.json.
Is it possible to add here more frameworks? Like Net45 and Net451,...?
是的,Visual Studio 2017 中的 .net 核心支持多框架定位。我们可以在 TargetFramework 中添加 net451、net461:
<PropertyGroup>
<TargetFrameworks>netcoreapp1.1;net461</TargetFrameworks>
<PropertyGroup>
If yes: How can I add the other (and old) dependencies? Like System.Data?
添加net461 TargetFramework后,nuget会自动恢复包。恢复完成后,您会看到 system.data.dll 被添加到 References:
希望对您有所帮助。
我正在尝试与 Visual Studio 2017 年合作。也许有人也曾与?我暂时找不到太多帮助。
因此,我创建了一个项目 .NET Core
Class Library
。
在 Visual Studio 2015 年,有那些 project.json
文件包含目标框架的信息。
我可以 s.th 像:
"frameworks": {
"netstandard1.5": { ...
},
"netstandard1.6": { ...
},
"netcoreapp1.0": { ...
},
"net45": { ...
},
"net451": { ...
}
} and so on
现在我创建了那个项目,还有那个旧的 *.csproj
xml-文件。
- 是否可以再次使用
json
-文件?
xml使用:
<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
</PropertyGroup>
是否可以在这里添加更多的框架?喜欢 Net45 和 Net451,...?
如果是:如何添加其他(和旧的)依赖项?喜欢
System.Data
?如果没有:如何在Nuget中使用不同的框架发布一个项目? Copy/Paste 项目和改变一切都没有多大意义,我认为。
Isn't it possible to use the json-file again?
据我所知,我们在Visual Studio 2017年不能使用project.json文件。因为.Net Core将基于msbuild,这意味着它将使用* .csproj 而不是 project.json.
Is it possible to add here more frameworks? Like Net45 and Net451,...?
是的,Visual Studio 2017 中的 .net 核心支持多框架定位。我们可以在 TargetFramework 中添加 net451、net461:
<PropertyGroup>
<TargetFrameworks>netcoreapp1.1;net461</TargetFrameworks>
<PropertyGroup>
If yes: How can I add the other (and old) dependencies? Like System.Data?
添加net461 TargetFramework后,nuget会自动恢复包。恢复完成后,您会看到 system.data.dll 被添加到 References:
希望对您有所帮助。