简体   繁体   English

即使Visual Studio 2015生成了,也找不到类库

[英]Visual Studio 2015 can't find class library even though it builds

I'm trying to share a class library between an ASP.NET Core project and a Xamarin Forms project. 我正在尝试在ASP.NET Core项目和Xamarin Forms项目之间共享类库。 So far I managed to make the project compile and actually work, however I have a problem referencing my file in Visual Studio. 到目前为止,我设法使项目能够编译并可以正常工作,但是在Visual Studio中引用我的文件时遇到了问题。

As shown in the image below, it says it can't find the class library (even though there is a reference to it and it build/runs correctly!) 如下图所示,它说找不到类库(即使有对它的引用并且它可以正确地构建/运行!)

I found out that when I delete the classlibrary, and load the xproj file instead of the csproj file it works in the Asp.net core project, but then it doesn't work in xamarin anymore. 我发现,当我删除类库并加载xproj文件而不是csproj文件时,它可以在Asp.net核心项目中使用,但是后来在xamarin中不再可用。

Any way to make it work in both projects? 有什么办法可以使其在两个项目中都能正常工作?

Edit: This is the solution I am talking about: https://github.com/arnvanhoutte/Drivr 编辑:这是我正在谈论的解决方案: https : //github.com/arnvanhoutte/Drivr

Visual Studio has sometimes issues like this. Visual Studio有时会出现这样的问题。 If you have a issue like this, copy the content from the class which is not found, delete it, create a new file/class with the name of the old file/class and paste the content. 如果您遇到这样的问题,请从未找到的类中复制内容,将其删除,使用旧文件/类的名称创建一个新文件/类,然后粘贴该内容。 Save and your problem should be fixed. 保存,您的问题应该得到解决。

在project-> properties中设置类路径

原来的解决方案是删除.xproj文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Visual Studio 2010-错误提示即使引用了程序集也找不到类 - Visual Studio 2010 - error saying can't find class even though assembly is referenced 即使我添加了对它的引用并确保它是公开的,Visual Studio也找不到控制器 - Visual studio can't find a controller even though I have added a reference to it and made sure it is public 在 Visual Studio 2015 for .net Core Class Library Project 中看不到模板 - Can't see templates in Visual Studio 2015 for .net Core Class Library Project 在visual studio 2015中找不到pointerpressed行 - Can't find pointerpressed row in visual studio 2015 Visual Studio 2015上的类库引用 - Class library references on Visual Studio 2015 在Visual Studio 2015中,可以设置只读自动属性并进行构建! 这是错误吗? - In Visual Studio 2015 readonly automatic properties can be set and it builds! Is this a bug? 即使统一构建,omnisharp 也找不到命名空间 - namespace can't be found by omnisharp even though unity builds 即使它具有未引用的类的名称,代码也可以在Visual Studio中编译并运行 - Code compiles and runs in Visual Studio even though it has the name of a class that isn't referenced Visual Studio,找不到参考 Microsoft Excel Object 库 - Visual Studio, can't find reference Microsoft Excel Object Library Visual Studio 2015构建类库可移植错误 - Visual Studio 2015 build class library portable error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM