问题描述
我在创建F#可移植项目时遇到问题,该问题应从C#可移植项目中引用.添加此类参考时,会出现以下消息:
I have problems creating F# portable project which than should be referenced from C# portable project. When adding such reference, the following message appears:
使用最新的Visual Studio 2015更新1(版本14.0.24720.00),很容易重现此问题.我还安装了Xamarin.
The problem is easily reproduced using latest Visual Studio 2015 Update 1 (version 14.0.24720.00). I also have Xamarin installed.
我可以使用任何具有以下可用功能的C#可移植项目来重现该问题:
I can reproduce the problem using any kind of C# portable project with following available:
- 类库(便携式)
- 类库(可用于iOS,Android和Windows)
以及任何类型的F#可移植库项目,其中包括以下内容:
and with any kind of F# portable library project with following available:
- 便携式库(.NET 4.5,Windows Store,Silverlight 5,Xamarin)[配置文件47]
- 便携式库(.NET 4.5,Windows Store,Windows Phone 8 Silverlight,Xamarin)[配置文件78]
- 便携式库(.NET 4.5,Windows Store,Windows Phone 8.1,Windows Phone Silverlight 8,Xamarin)[配置文件259]
- 便携式库(.NET 4.5,Windows Store,Xamarin)[配置文件7]
我对C#使用的配置文件与对F#使用的配置文件相同,没有任何帮助.
I've used the same profiles for C# as for F# and nothing helps.
好像以前已经存在这样的问题(如何从C#可移植类库(PCL)添加对F#可移植库的引用),则此问题已成功修复.但现在又被复制了.
Seems like there already was a such issue before (How do I add a reference to F# Portable Library from C# Portable Class Library (PCL)) which then was successfully fixed. But it is now reproduced again.
有人可以告诉我我错过了什么吗?也许需要额外安装一些东西?
Can somebody please tell me am I missing something? Maybe there is something which needs to be additionally installed or so?
推荐答案
我只是遇到了同样的问题.我通过入侵PCL的.csproj解决了该问题.之后,在C#项目中引用了F#PCL,我可以使用所有东西.我不知道是否有任何问题-我无法解决任何问题.
I just had the same issue. I solved it with hacking the .csproj of my PCL. After that the F# PCL is referenced in the C# project and I can use everything. I don't know if there are any problems - I could not figure out any.
以下是复制步骤:
- 新的C#项目(便携式类配置文件111)
- 新的F#项目(便携式类概要7)
- 查看F#.fsproj文件并复制"Project/PropertyGroup/ProjectId"的值
-
编辑C#.csproj并添加以下项目组
- new C# project (portable class profile 111)
- new F# project (portable class profile 7)
- look into F# .fsproj file and copy value of "Project/PropertyGroup/ProjectId"
edit C# .csproj and add following itemgroup
<ItemGroup>
<ProjectReference Include="..\F# Project\F# Project.fsproj">
<Project>{F# Project Id}</Project>
<Name>F# Project</Name>
</ProjectReference>
</ItemGroup>
我正在将Visual Studio 2015社区与Update 2一起使用
I'm using Visual Studio 2015 Community with Update 2
这篇关于无法将参考从C#PCL添加到F#PCL(VS 2015 Update 1)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!