F#、Visual Studio 2017 和 dotnet new [英] F#, Visual Studio 2017 and dotnet new
问题描述
要从命令行创建 .NET 类库,您可以运行脚本
To create a .NET class library from the command line, you can run the script
dotnet new classlib
在一个干净的文件夹中执行此操作,它将创建一个 csproj
文件,然后可以在 Visual Studio 2017 中打开该文件.
Do that in a clean folder, and it will create a csproj
file that can then be opened in Visual Studio 2017.
但是,运行脚本
dotnet new classlib -lang f#
在一个干净的文件夹中,随后创建的fsproj文件在Visual Studio 2017中无法打开.错误信息为
in a clean folder, and the fsproj file that is subsequently create cannot be opened in Visual Studio 2017. The error message reads
未找到导入的项目C:Program Files (x86)Microsoft Visual Studio2017ProfessionalMSBuildSdksFSharp.NET.SdkSdkSdk.props".确认声明中的路径正确,并且该文件存在于磁盘上.
The imported project "C:Program Files (x86)Microsoft Visual Studio2017ProfessionalMSBuildSdksFSharp.NET.SdkSdkSdk.props" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.
我已经搜索了此问题的说明,似乎正在进行修复工作,但在此期间我想知道是否可以安装任何加载项以使其立即工作.
I have searched for clarification of this issue, and it appears that there is work ongoing to fix it, but I wondered in the interim if there are any add-ins I can install to get this working immediately.
推荐答案
Visual Studio 和 .NET Core 的最新预览版本显然支持加载 .fsproj 项目.
The latest preview releases of Visual Studio and .NET Core support loading .fsproj projects, apparently.
现在关闭它,因为这些项目加载了 15.3.当前使用它们的方式:
Closing this now, as these projects load with 15.3. The current way to use them:
- 下载 VS 2017 Update 3 Preview 3(或进一步预览,如果它已发布并且您正在阅读本文)
- 从这里下载最新的 CLI/SDK:https://github.com/dotnet/cli/tree/release/2.0.0#installers-and-binaries
(是的,.NET SDK 独立于 VS.您还需要它才能在 VS 2017 Update 3 Previews 中获得 .NET Core 2.0 支持).
(Yes, the .NET SDK is independent of VS. You will also need this to get .NET Core 2.0 support in VS 2017 Update 3 Previews).
这篇关于F#、Visual Studio 2017 和 dotnet new的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!