简体   繁体   English

Visual Studio - 单击解决方案 - >属性时出错(对象引用未设置为对象的实例)

[英]Visual Studio - Error when clicking on Solution -> Properties (Object reference not set to an instance of an object)

When i try to access my solution Properties, i get the following error: 当我尝试访问我的解决方案属性时,我收到以下错误:

Object reference not set to an instance of an object

I am using VS 2012. What could be the cause of this? 我正在使用VS 2012.这可能是什么原因?

在此输入图像描述

在此输入图像描述

Some extensions may cause this. 某些扩展可能会导致此问题 Try disabling extensions and restarting Visual Studio. 尝试禁用扩展并重新启动Visual Studio。

Quite often error will be gone even if you re-enable extensions after this. 即使您在此之后重新启用扩展,通常也会出现错误。

There's a bug report on Microsoft Connect ( link ). 有关Microsoft Connect( 链接 )的错误报告。 It is marked there as "Closed as External", but it seems that it may occur randomly with any extension, so would be worth voting it there to bring it to Microsofts attention. 它被标记为“封闭为外部”,但似乎它可能随机出现任何扩展,因此值得在那里投票以引起微软的注意。

In my case, the problem was solution-specific. 就我而言,问题是解决方案特定的。 NuGet was causing this error, but not the extension itself but a NuGet package that generated an error on VS load. NuGet导致此错误,但不是扩展本身,而是在VS负载上生成错误的NuGet包。 When I opened NuGet Package Manager Console I saw a big red text with a description of the error. 当我打开NuGet包管理器控制台时,我看到一个带有错误描述的大红色文本。 In my case it was T4Scaffolding.Core package, which in turn is a dependency of MVCMailer. 在我的例子中,它是T4Scaffolding.Core包,而后者又是MVCMailer的依赖。

If this is your case, you will probably see what package generates an error in PM Console. 如果是这种情况,您可能会在PM控制台中看到哪个包生成错误。

I faced this dialog too and i'm not sure what exactly causes this as i couldn't even open the NuGet console to see detailed error messages. 我也遇到了这个对话框,我不确定究竟是什么导致这种情况,因为我甚至无法打开NuGet控制台来查看详细的错误消息。

Closing Visual Studio, deleting %AppData%\\Microsoft\\VisualStudio and restarting Visual Studio worked for me as it causes a reset of various things like window configurations. 关闭Visual Studio,删除%AppData%\\Microsoft\\VisualStudio并重新启动Visual Studio,因为它会导致窗口配置等各种事情的重置。

I think if this dialog is displayed some files may be corrupt in %AppData%\\Microsoft\\VisualStudio and by deleting that folder Visual Studio can start normally again. 我想如果显示此对话框, %AppData%\\Microsoft\\VisualStudio某些文件可能已损坏,并且删除该文件夹Visual Studio可以再次正常启动。

Update: 更新:

The issue arises on my machine when i start Visual Studio by using "run as administator" whereas Visual Studio has been started before without that option and %AppData%\\Microsoft\\VisualStudio had been created without the administator association . 当我通过使用“作为管理员运行”启动Visual Studio而在没有该选项的情况下启动Visual Studio并且在没有管理员关联的情况下创建%AppData%\\Microsoft\\VisualStudio时,问题出现在我的机器上。

Visual Studio 2013: I had this issue when I tried opening TOOLS -> Extensions and Updates. Visual Studio 2013:当我尝试打开TOOLS - >扩展和更新时,我遇到了这个问题。 I used @ViRuSTriNiTy idea, but only cleaned the files from: C:\\Users[myUserName]\\AppData\\Local\\Microsoft\\VisualStudio\\12.0\\Extensions There are 2 cache files over there. 我使用了@ViRuSTriNiTy的想法,但只清理了以下文件:C:\\ Users [myUserName] \\ AppData \\ Local \\ Microsoft \\ VisualStudio \\ 12.0 \\ Extensions那里有2个缓存文件。 Deleted them and restarted VS2013 and it was fixed 删除它们并重新启动VS2013并修复了它

The way it was happening for me might be unique to me/my setup, but I'd love to know if anyone else has this happen, and if they find out why: 它的发生方式可能对我/我的设置来说是独一无二的,但我很想知道其他人是否有这种情况发生,如果他们发现原因:

  • If I launch an .sln file by double-clicking it, it will load VS and I can right-click the Solution and get Properties to come up no problem. 如果我通过双击它来启动.sln文件,它将加载VS,我可以右键单击解决方案并获取属性,没有问题。
  • If I go to "Open Project" on the Visual Studio welcome page or from File > Open > Project/Solution, navigate to the .sln file and launch it by selecting it and clicking "Open" in the File dialog, that's when I have this issue. 如果我在Visual Studio欢迎页面或“文件”>“打开”>“项目/解决方案”中转到“打开项目”,请导航到.sln文件并通过选择它并单击“文件”对话框中的“打开”来启动它。这个问题。

I'm going to just always launch the .sln file from now on, but I'd love to know why this happens when using "Open Project" from the welcome page or from File > Open > Project/Solution! 我将从现在开始始终启动.sln文件,但我很想知道为什么在欢迎页面或文件>打开>项目/解决方案中使用“打开项目”时会发生这种情况! I tried going into Tools > NuGet Package Manager > General and I unchecked the options for allowing NuGet to download missing packages and Skip applying binding redirects, and under Package Sources I de-selected the checkboxes (my dev machine does not connect to the internet). 我尝试进入工具> NuGet包管理器>常规,我取消选中允许NuGet下载丢失的包和跳过应用绑定重定向的选项,并在包源下取消选中复选框(我的开发机器没有连接到互联网) 。 Environment > Extensions and Updates: I tried it with and without "Load per user extensions when running as administrator" and running it as an Admin and without running as Admin. 环境>扩展和更新:我尝试使用和不使用“以管理员身份运行时按用户扩展加载”并将其作为管理员运行而不以管理员身份运行。 Also tried just deleting everything at C:\\Users\\me\\AppData\\Local\\Microsoft\\VisualStudio. 还尝试删除C:\\ Users \\ me \\ AppData \\ Local \\ Microsoft \\ VisualStudio中的所有内容。 No change from those 2 bullets above. 上面的那两颗子弹没有变化。

暂无
暂无

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

相关问题 Visual Studio 2022,每个新的 VB 项目,“属性”>“编译”都会出现“对象引用未设置到对象的实例”错误 - Visual Studio 2022, every new VB project, Properties>Compile gives "Object reference not set to an instance of an object" error 对象引用未设置为Visual Studio 2013上的对象错误的实例 - Object reference not set to an instance of an object error on Visual Studio 2013 适用于Visual Studio的Azure流分析工具:执行聚合查询时出错-“对象引用未设置为对象的实例” - Azure Stream Analytics tools for Visual Studio: Error when executing aggregated queries - “Object reference not set to an instance of an object” Visual Studio 中的 SQL Server 单元测试:由于“对象引用未设置到对象的实例”,无法设置测试条件属性。 错误 - SQL Server Unit Test in Visual Studio: Unable to set test condition properties due to "Object reference not set to an instance of an object." error Visual Studio 2017-TFS 2017-“对象引用未设置为对象的实例” - Visual Studio 2017 - TFS 2017 - “Object reference not set to an instance of an object” 安装 ASP.NET 和 Web Tools 2015 后出现 Visual Studio 错误“未将对象引用设置为对象的实例” - Visual Studio error "Object reference not set to an instance of an object" after install of ASP.NET and Web Tools 2015 Visual Studio XAML设计窗口错误:对象引用未设置为对象的实例 - Visual Studio XAML Design Window Error: Object reference not set to an instance of an object 签出另一个分支后出现 Visual Studio git 错误“对象引用未设置到对象的实例” - Visual Studio git error "Object reference not set to an instance of an object" after checking out another branch Visual Studio 2015:创建Azure移动应用程序时,“对象引用未设置为对象的实例” - Visual Studio 2015: “Object reference not set to an instance of an object” when creating Azure Mobile App 在visual studio 2013中打开cshtml文件时,对象引用未设置为对象的实例 - Object reference not set to an instance of an object when opening cshtml files in visual studio 2013
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM