我正在将一个项目(和数据库)从windows、sqlserver和visualstudio转移到linuxmint、mysql和monodevelop。我已经完成了大部分工作——但是我无法让mysql的类型提供程序工作。最明显的症结似乎是:
open FSharp.Data.Sql
出现错误,未定义“sql”的命名空间(我看不到这个名字的nuget包。)
以下各项均无错误:
open MySql.Data
open MySqlConnector
open FSharp.Data
我似乎有以下文件包/参考资料:
MySqlConnector
MySql.Data
FSharp.Data
FSharp.Data.SqlClient
FSharp.Data.TypeProviders
然后我还得到一个错误:
SqlDataProvider
“未定义类型”“sqldataprovider”“。”。
我相信这很简单,但我不太擅长使用哪种或如何使用参考资料——抱歉,谢谢。
)我真的不知道怎么区分 SQLProvider
从 FSharp.Data.Sql
提供程序来自 MySql.Data.dll
从 MySqlConnector.dll
...)
编辑:谢谢你的提问。我假设这是.net框架,而不是核心。大约3年前,这个项目起源于默认的visualstudio模板,我从来没有对核心做过任何事情。
对于fsproj文件--我不确定是什么。我有4个项目的解决方案(只有2个正在积极使用)。对于具有类型提供程序类型的项目,这是/obj/debug中的project.fsproj.filelistabsolute.txt。
C:/Users/gen/Desktop/Simulations/SqlFunctions/bin/Debug/Library3.XML
C:/Users/gen/Desktop/Simulations/SqlFunctions/bin/Debug/Library3.exe
C:/Users/gen/Desktop/Simulations/SqlFunctions/bin/Debug/Library3.pdb
C:/Users/gen/Desktop/Simulations/SqlFunctions/bin/Debug/FSharp.Core.dll
C:/Users/gen/Desktop/Simulations/SqlFunctions/bin/Debug/FSharp.Data.TypeProviders.dll
C:/Users/gen/Desktop/Simulations/SqlFunctions/bin/Debug/FSharp.Core.xml
C:/Users/gen/Desktop/Simulations/SqlFunctions/bin/Debug/FSharp.Data.TypeProviders.xml
C:/Users/gen/Desktop/Simulations/SqlFunctions/obj/Debug/Library3.exe
C:/Users/gen/Desktop/Simulations/SqlFunctions/obj/Debug/Library3.pdb
/home/gen/Downloads/Simulations 2018-07-29/SqlFunctions/bin/Debug/Library3.XML
/home/gen/Downloads/Simulations 2018-07-29/SqlFunctions/obj/Debug/SqlFunctions.fsprojResolveAssemblyReference.cache
/home/gen/Downloads/Simulations 2018-07-29/SqlFunctions/obj/Debug/Library3.exe
/home/gen/Downloads/Simulations 2018-07-29/SqlFunctions/obj/Debug/Library3.pdb
上半部分看起来像旧的windows引用-?显然,其中没有一个包含类似mysql.data的内容——它确实出现在project/references/from包中。
哦,等等,这在解决方案级别可能更相关(我从未处理过.fsproj文件):
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>397e58f9-3730-4c45-a36f-7c9f64d94f1d</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>Simulations</RootNamespace>
<AssemblyName>Simulations</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<TargetFSharpCoreVersion>4.4.0.0</TargetFSharpCoreVersion>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Name>Simulations</Name>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<Tailcalls>false</Tailcalls>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<WarningLevel>3</WarningLevel>
<DocumentationFile>bin\Debug\Simulations.XML</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<Tailcalls>true</Tailcalls>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<WarningLevel>3</WarningLevel>
<DocumentationFile>bin\Release\Simulations.XML</DocumentationFile>
</PropertyGroup>
<PropertyGroup>
<MinimumVisualStudioVersion Condition="'$(MinimumVisualStudioVersion)' == ''">11</MinimumVisualStudioVersion>
</PropertyGroup>
<Choose>
<When Condition="'$(VisualStudioVersion)' == '11.0'">
<PropertyGroup Condition="Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets')">
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets</FSharpTargetsPath>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets')">
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets</FSharpTargetsPath>
</PropertyGroup>
</Otherwise>
</Choose>
<Import Project="$(FSharpTargetsPath)" />
<ItemGroup>
<Compile Include="AssemblyInfo.fs" />
<Compile Include="1a.fs" />
<Compile Include="2a.fs" />
<Compile Include="2b.fs" />
<Compile Include="2c.fs" />
<Compile Include="2d.fs" />
<Compile Include="2e.fs" />
<Compile Include="2f.fs" />
<Compile Include="3a.fs" />
<Compile Include="3b.fs" />
<Compile Include="3c.fs" />
<Compile Include="3d.fs" />
<Compile Include="4a.fs" />
<Compile Include="4b.fs" />
<Compile Include="4c.fs" />
<Compile Include="5a.fs" />
<Compile Include="5b.fs" />
<Compile Include="5c.fs" />
<Compile Include="5d.fs" />
<Compile Include="5e.fs" />
<Compile Include="6a.fs" />
<Compile Include="6b.fs" />
<Compile Include="7a.fs" />
<None Include="Script.fsx" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Reference Include="mscorlib" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data.Linq" />
<Reference Include="System.Numerics" />
<Reference Include="FSharp.Core">
<HintPath>packages\FSharp.Core.4.5.2\lib\net45\FSharp.Core.dll</HintPath>
</Reference>
<Reference Include="FSharp.Data.TypeProviders">
<HintPath>packages\FSharp.Data.TypeProviders.5.0.0.6\lib\net40\FSharp.Data.TypeProviders.dll</HintPath>
</Reference>
<Reference Include="System.ValueTuple">
<HintPath>packages\System.ValueTuple.4.5.0\lib\netstandard1.0\System.ValueTuple.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="SqlFunctions\SqlFunctions.fsproj">
<Name>SqlFunctions</Name>
<Project>{14eefa95-3b68-4348-a7de-db29bfb3567f}</Project>
<Private>True</Private>
</ProjectReference>
</ItemGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
再次感谢。
编辑2:正如我在下面的评论——情况已经发展到(我认为):当读卡器关闭时读取的尝试无效——类型声明错误。
暂无答案!
目前还没有任何答案,快来回答吧!