我想使用共享项目。它适用于iOS / Android项目。现在我想创建一个用于进行单元测试的控制台项目。
然而,尽管在编辑器中找到了模块并且intellisense为它们工作,但在编译时我得到:
..Test/TestsClient.fs(6,6): Error FS0039: The namespace or module 'Db' is not defined. (FS0039) (Test)
和其他人一样。
我的目标是.NET 4.6.2,并且使用4.5进行了测试。
这是项目:
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
<ProjectGuid>{90334D33-1842-4D13-8367-069308850F4E}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>Cobros</RootNamespace>
<AssemblyName>Test</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<ExternalConsole>true</ExternalConsole>
<GenerateTailCalls>true</GenerateTailCalls>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<DefineConstants></DefineConstants>
<ErrorReport>prompt</ErrorReport>
<ExternalConsole>true</ExternalConsole>
<GenerateTailCalls>true</GenerateTailCalls>
</PropertyGroup>
<PropertyGroup>
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets</FSharpTargetsPath>
</PropertyGroup>
<PropertyGroup Condition="'$(VisualStudioVersion)' == '10.0' OR '$(VisualStudioVersion)' == '11.0'">
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets</FSharpTargetsPath>
</PropertyGroup>
<ItemGroup>
<Reference Include="mscorlib" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Numerics" />
<Reference Include="System.ValueTuple">
<HintPath>..\packages\System.ValueTuple.4.3.0\lib\netstandard1.0\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="Fuchu">
<HintPath>..\packages\Fuchu.1.0.3.0\lib\Fuchu.dll</HintPath>
</Reference>
<Reference Include="FSharp.Core">
<HintPath>..\packages\FSharp.Core.4.2.1\lib\net45\FSharp.Core.dll</HintPath>
</Reference>
<Reference Include="System.Data" />
<Reference Include="Mono.Data.Sqlite" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.fs" />
<None Include="packages.config" />
<Compile Include="TestUtils.fs" />
<Compile Include="TestsClient.fs" />
<Compile Include="Program.fs" />
</ItemGroup>
<Import Project="..\CobrosDb.projitems" Label="Shared" Condition="Exists('..\CobrosDb.projitems')" />
<Import Project="$(FSharpTargetsPath)" />
</Project>
这是构建日志:
Target GenerateTargetFrameworkMonikerAttribute:
Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
Target CoreCompile:
/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/fsharp/fsc.exe -o:obj/iPhoneSimulator/Debug/Test.exe
-g
--debug:full
--noframework
--define:DEBUG
--optimize-
--tailcalls-
-r:.../Movil/packages/FSharp.Core.4.2.1/lib/net45/FSharp.Core.dll
-r:.../Movil/packages/Fuchu.1.0.3.0/lib/Fuchu.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Mono.Data.Sqlite.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/mscorlib.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/System.Core.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/System.Data.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/System.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/System.Numerics.dll
-r:.../Movil/packages/System.ValueTuple.4.3.0/lib/netstandard1.0/System.ValueTuple.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/System.Xml.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.Collections.Concurrent.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.Collections.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.ComponentModel.Annotations.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.ComponentModel.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.ComponentModel.EventBasedAsync.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.Diagnostics.Contracts.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.Diagnostics.Debug.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.Diagnostics.Tools.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.Diagnostics.Tracing.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.Dynamic.Runtime.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.Globalization.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.IO.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.Linq.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.Linq.Expressions.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.Linq.Parallel.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.Linq.Queryable.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.Net.NetworkInformation.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.Net.Primitives.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.Net.Requests.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.Net.WebHeaderCollection.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.ObjectModel.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.Reflection.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.Reflection.Emit.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.Reflection.Emit.ILGeneration.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.Reflection.Emit.Lightweight.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.Reflection.Extensions.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.Reflection.Primitives.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.Resources.ResourceManager.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.Runtime.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.Runtime.Extensions.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.Runtime.Handles.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.Runtime.InteropServices.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.Runtime.InteropServices.WindowsRuntime.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.Runtime.Numerics.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.Runtime.Serialization.Json.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.Runtime.Serialization.Primitives.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.Runtime.Serialization.Xml.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.Security.Principal.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.ServiceModel.Duplex.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.ServiceModel.Http.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.ServiceModel.NetTcp.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.ServiceModel.Primitives.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.ServiceModel.Security.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.Text.Encoding.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.Text.Encoding.Extensions.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.Text.RegularExpressions.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.Threading.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.Threading.Tasks.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.Threading.Tasks.Parallel.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.Threading.Timer.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.Xml.ReaderWriter.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.Xml.XDocument.dll
-r:/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/4.6.2-api/Facades/System.Xml.XmlSerializer.dll
--target:exe
--warnaserror:76
--fullpaths
--flaterrors
--subsystemversion:6.00
--highentropyva+
/var/folders/tm/n9jvsc5s4m72hg8_r47dn4z40000gn/T/.NETFramework,Version=v4.6.2.AssemblyAttributes.fs
AssemblyInfo.fs
TestUtils.fs
TestsClient.fs
Program.fs
.../Movil/Db.fs
.../Movil/DbClient.fs
.../Movil/Utils.fs
.../Movil/Test/TestsClient.fs(6,6): error FS0039: The namespace or module 'Db' is not defined.