简体   繁体   English

Visual Studio 2013 中的“您是否缺少 using 指令或程序集引用”

[英]“Are you missing a using directive or an assembly reference” in visual studio 2013

Good Day everyone.大家好。 I'm developing a Cross Platform Application in Xamarin.Forms when I encounter this error "Are you missing a using directive or an assembly reference".当我遇到此错误“您是否缺少 using 指令或程序集引用”时,我正在 Xamarin.Forms 中开发跨平台应用程序。 My project is working fine before I install a Nuget package (Circle Image View in Xamarin), but when I uninstall it (without changing a single line of code) the said error started to appear.在我安装 Nuget 包(Xamarin 中的圆形图像视图)之前,我的项目运行良好,但是当我卸载它(不更改任何一行代码)时,上述错误开始出现。 I tried to Build, Rebuild it but still it does not work.我尝试构建,重建它,但仍然无法正常工作。 Anything I can do to fix this?我能做些什么来解决这个问题? Any help will be appreciated.任何帮助将不胜感激。 Thanks a lot.非常感谢。

These are the errors:这些是错误:

Error 1:错误 1:

The type or namespace name 'Xamarin' could not be found (are you missing a using directive or an assembly reference?)找不到类型或命名空间名称“Xamarin”(您是否缺少 using 指令或程序集引用?)

Error 2:错误 2:

The type or namespace name 'Application' could not be found (are you missing a using directive or an assembly reference?)找不到类型或命名空间名称“应用程序”(您是否缺少 using 指令或程序集引用?)

Error 3:错误 3:

The type or namespace name 'Xamarin' could not be found (are you missing a using directive or an assembly reference?)找不到类型或命名空间名称“Xamarin”(您是否缺少 using 指令或程序集引用?)

Error 4:错误 4:

The type or namespace name 'ContentPage' could not be found (are you missing a using directive or an assembly reference?)找不到类型或命名空间名称“ContentPage”(您是否缺少 using 指令或程序集引用?)

When I got an error like this on my Environment, I do following:当我的环境出现这样的错误时,我会执行以下操作:

  1. Clean solution in VisualStudio VisualStudio 中的清洁解决方案
  2. Close VisualStudio关闭 VisualStudio
  3. Delete all "bin" and "obj" Folders (from the whole solution) manually手动删除所有“bin”和“obj”文件夹(从整个解决方案中)
  4. Delete "packages" Folder manually手动删除“packages”文件夹
  5. Restart VisualStudio重新启动 VisualStudio
  6. Rebuild all全部重建

In most cases, this solves this reference-problems (in my case)在大多数情况下,这解决了这个参考问题(在我的情况下)

It sounds like you're missing your Xamarin.Forms packages.听起来您缺少 Xamarin.Forms 包。

Can you expand your Packages directory in the Solution Explorer, and see if it's in there?你能在解决方案资源管理器中展开你的Packages目录,看看它是否在那里吗?


Try this :试试这个:

  1. Select the project in the Solution tabSolution选项卡中选择项目
  2. Select Project along the top menu选择顶部菜单中的Project
  3. Select Add Nuget Packages ...选择Add Nuget Packages ...
  4. Do a search for Xamarin.forms搜索Xamarin.forms
  5. Add Xamarin.forms to that projectXamarin.forms添加到该项目
  • Right click on the referenced project -> Unload Project右键单击引用的项目 -> 卸载项目
  • Right click on the referenced project -> Edit ...右键单击引用的项目-> 编辑...
  • Add a space after any line in the file在文件中的任何行后添加一个空格
  • Save保存
  • Right click on the referenced project -> Reload Project右键单击引用的项目 -> 重新加载项目

What is the nuget package that you uninstall?你卸载的 nuget 包是什么? Are you sure you aren't using anywhere in the code.你确定你没有在代码中的任何地方使用。 If there are any references to it you will get this error.如果有任何引用,您将收到此错误。

For example if you have:例如,如果您有:

using Ninject;

And then you uninstall ninject you would get this error.然后你卸载ninject你会得到这个错误。

这发生在我身上,我的问题是我将 dll 编译为比我添加引用的项目更新的 .net 框架版本。

For me, it helped to add this line to my *.csproj:对我来说,将这一行添加到我的 *.csproj 中是有帮助的:

<Reference Include="...">
    <SpecificVersion>False</SpecificVersion>
</Reference>

I just quit Visual Studio and started it again.我刚刚退出 Visual Studio 并重新启动它。 The error was gone!错误消失了!

As well as deletion of bin and packages folders manually, deleting the respective error from the test.Android.csproj file worked for me.以及手动删除binpackages文件夹,从test.Android.csproj文件中删除相应的错误对我test.Android.csproj The error was错误是

this project references nuget package(s) that are missing on this computer此项目引用了此计算机上缺少的 nuget 包

My case was very weird.我的情况很奇怪。 I suddenly started getting this for just one file for no reason at all.我突然开始无缘无故地只为一个文件获取此信息。

After deleting and retyping the using directives, the error was gone.删除并重新键入using指令后,错误消失了。

暂无
暂无

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

相关问题 Visual Studio 2010 - 您是否缺少using指令或程序集引用? - Visual Studio 2010 — are you missing a using directive or an assembly reference? 您是否缺少using指令或程序集引用。 Visual Studio WebDeveloper 2010 - Are you missing a using directive or an assembly reference. Visual Studio WebDeveloper 2010 错误:您是否缺少使用指令或程序集引用的信息? - error:are you missing using directive or a assembly reference? 找不到类型或名称空间名称“ MySql”(您是否缺少using指令或程序集引用?)c#VS 2013 - The type or namespace name 'MySql' could not be found (are you missing a using directive or an assembly reference?) c# VS 2013 随机程序集引用失败(“您是否缺少 using 指令或程序集引用?”) - Random assembly references fail (“Are you missing a using directive or an assembly reference?”) 找不到“ IdentityContext”(您是否缺少using指令或程序集引用) - 'IdentityContext' could not be found (are you missing a using directive or an assembly reference) 编译错误 - 您是否缺少 using 指令或程序集引用? - Compilation Error - are you missing a using directive or an assembly reference? 找不到“位图”(您是否缺少 using 指令或程序集引用?) - 'Bitmap' could not be found (are you missing a using directive or an assembly reference?) 找不到类型或命名空间(您是否缺少using指令或程序集引用?) - The type or namespace cannot be found (are you missing a using directive or an assembly reference?) CS1061 :(您是否缺少using指令或程序集引用? - CS1061: (are you missing a using directive or an assembly reference?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM