我正在尝试使用FSharp.Data(标准typeprovider库)创建一个dotnet-core F#项目作为linux下的依赖项。
我使用命令dotnet new -l F#
创建了一个项目,并添加了FSharp.Data
作为依赖项。
{
"version": "1.0.0-*",
"buildOptions": {
"emitEntryPoint": true,
"compilerName": "fsc",
"compile": {
"includeFiles": [
"Program.fs"
]
}
},
"dependencies": {
"Microsoft.FSharp.Core.netcore": "1.0.0-alpha-160316",
"FSharp.Data": {"version": "2.3.1"},
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0-rc2-3002702"
}
},
"tools": {
"dotnet-compile-fsc": {
"version": "1.0.0-*",
"imports": [
"dnxcore50",
"portable-net45+win81",
"netstandard1.3"
]
}
},
"frameworks": {
"netstandard1.5": {
"imports": [
"portable-net45+win8",
"dnxcore50"
]
}
}
}
然而,当我尝试构建项目时(通过执行dotnet restore
后跟dotnet build
)我得到一个错误,我认为可以归结为Could not load file or assembly 'FSharp.Data.DesignTime....
Project fsharp2 (.NETStandard,Version=v1.5) will be compiled because inputs were modified
Compiling fsharp2 for .NETStandard,Version=v1.5
/home/michel/dotnet/dotnet compile-fsc @/home/michel/Documents/DOTNET/fsharp2/obj/Debug/netstandard1.5/dotnet-compile.rsp returned Exit Code 1
/home/michel/Documents/DOTNET/fsharp2/error FS3031: The type provider '/home/michel/.nuget/packages/FSharp.Data/2.3.1/lib/portable-net45+netcore45/FSharp.Data.dll' reported an error: Assembly attribute 'TypeProviderAssemblyAttribute' refers to a designer assembly 'FSharp.Data.DesignTime' which cannot be loaded or doesn't exist. Could not load file or assembly 'FSharp.Data.DesignTime, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
/home/michel/Documents/DOTNET/fsharp2/warning FS3005: Referenced assembly '/home/michel/.nuget/packages/FSharp.Data/2.3.1/lib/portable-net45+netcore45/FSharp.Data.dll' has assembly level attribute 'Microsoft.FSharp.Core.CompilerServices.TypeProviderAssemblyAttribute' but no public type provider classes were found
Compilation failed.
1 Warning(s)
1 Error(s)
Time elapsed 00:00:05.0221430
我已检查FSharp.Data.DesignTime.dll
目录下是否存在.nuget/packages/FSharp.Data/2.3.1/lib/portable-net45+netcore45/
文件。 dotnet-core也可以很好地用于简单的hello world程序,而不需要添加额外的依赖项。
如何在我的dotnet-core项目中成功添加FSharp.Data作为依赖项?