I'm using Visual studio 2017 for past few years. Now, first line of all aspx page shows below error on all my existing web applications.
Runtime error: Object reference not set to an instance of an object.
Also I tried to create a new project. It is also showing same issue. And when I try to run those project, It shows "localhost refused to connect."
I have tried many solutions from web. But couldn't solve the issue. What I tried are,
Deleted .vs folder
Deleted .suo file
Clean and rebuild
Uninstalled VS 2017 and reinstalled. Now I'm using version 15.9.34
UPDATE 1
I have uninstalled VS 2017 and installed VS 2019. Still showing same error for website projects. I have installed .NET frame work version V4.0.30319 and ASP.NET and web development tools.
Current Situation:
I have an ASP.NET web project. (Framework Version: .NET Framework 4.5.2)
One developer here is able to compile it and run it fine in Visual Studio 2017.
I cannot, I get the "could not load file or assembly" error for a reference that is in my list of references.
Screenshots:
Error:
Bin Folder:
Web.config Potential Relevant Sections:
DevExpress Licenses File:
DevExpress Library File's Details:
Things I've Tried:
Clean Solution & Rebuild Solution
Deleted solution locally and clean get of solution from source control
Clearing out my temp directory
Opening the project in Visual Studio 2015
Having the developer zip up his local copy of the solution / project and sending it to me (When I ran his copy locally I continued to get the same error.)
Re-adding the existing library it's complaining about
Manually deleting and re-adding all the libraries in my BIN folder
Messing with the license file, web.config, and assembly references in code (including adjusting the version numbers because for some reason the version number is 17.2.5.0 anywhere it's referenced in the project, but the file's Details actually says it's 17.2.9.0?)
Smashing my face into my keyboard...
...Always the same error.
Additional Information
Other developers run into the same exact error under the same conditions as me, only my one developer who's been working in this project can build it fine
I just noticed that on a new copy of the work project, my references window is showing 2 of the same reference to the DevExpress.Data library (one in the GAC and one in the BIN) but when I try re-adding the reference to my project, the one in the BIN disappears from my references window:
We have been encountering more and more frequently the Visual Studio error of being unable to generate the designer file in a web project. This problem has been occurring for a few months now, in several of our ASP.NET projects.
The errors occur when saving a file or when building the project, and are variations of errors like this:
Generation of the designer file for [filename] failed: Error HRESULT
E_FAIL has been returned from a call to a COM component.
Generation of the designer file for [filename] failed: Unspecified
error (Exception from HRESULT: 0x80004005 (E_FAIL))
Generation of the designer file for [filename] failed: An entry with
the same key already exists.
Generation of the designer file for [filename] failed: Value cannot
be null.
Sometimes, additional error messages are displayed for valid, previously-working code/markup; errors such as:
The name 'Eval' does not exist in the current context
This is with Visual Studio 2013 (Premium), with "Web Application Projects" type projects using the .NET 4.5 framework. Some of the projects were originally created in Visual Studio 2010 or Visual Studio 2012, but one of the projects was a new project created in Visual Studio 2013.
We have a few Visual Studio extensions installed, such as "Web Essentials 2013", but I have tried disabling all the installed Visual Studio extensions and the same designer file errors still occur. We do not have Resharper or CodeRush installed. We are also using a third-party components package (DevExpress) for ASP.NET. We are using IIS Express for the local development web server.
All available updates (including Update 1 for Visual Studio 2013) have been installed for Visual Studio, the operating system (Windows 8.1), .NET, Visual Studio extensions, and DevExpress.
I have searched StackOverflow and the web for this issue, and have found some suggestions but no solutions, and I have also seen that the issue has been reported to Microsoft several times, dating back some years.
Many indications are that the problem with generating designer files is caused by some invalid syntax (in an ASPX file), or multiple elements with the same ID in the same scope, or collisions in namespace or class names, etc. I have searched through our projects as best as I can for issues like this, but haven't found any.
I found the Redesigner project on Sourceforge (thanks very much to the author), and I tried using that to verify the designer files, but unfortunately it can't handle the DevExpress components (it reports that DevExpress elements are using invalid child tags when the tags are valid and correct for DevExpress).
I have also tried clearing the Visual Studio development cache on my workstation (that is, deleting everything from the folders "\Temp\IISExpress", "\Temp\Temporary ASP.NET Files", and "\Microsoft\WebsiteCache" folders in the %localappdata% folder, rebooting and restarting Visual Studio.
I also found a website that explained how to turn on additional logging for Visual Studio to help with tracking down designer file generation issues. For Visual Studio 2013, this requires adding a key HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0\WebApplicationProjects\Debug and then adding values under that key for "Enabled" (set to 1), "LogFieldGeneratorFailures" (set to 1), and "LogFile" (set to a path and filename that you have permission to write to).
When I added this key, Visual Studio 2013 did write to the debug log file, but it only included error messages similar to the error messages above plus a small stack trace plus the entire content of the ASPX file for which the designer file could not be generated (with no apparent indication of where in the ASPX page there might be an error or invalid syntax).
I think I have tried essentially all suggested approaches in this topic:
How do you force Visual Studio to regenerate the .designer files for aspx/ascx files?
None of these have worked for me. The "Convert to Web Application" option for the ASPX file is not available for me in Visual Studio 2013 in these projects.
Does anyone have any suggestions for potential causes or fixes for this desinger file issue or for any other troubleshooting approaches?
The latest that we have discovered with this issue is that it's related to the Source Control option in Visual Studio to "Get everything when a solution or project is opened".
Having this option UNCHECKED seems to have resolved the problems for our team so far (for the past few days).
There is also this issue posted at Microsoft Connect: http://connect.microsoft.com/VisualStudio/feedback/details/760443/visual-studio-2012-ide-loses-intellisense-and-reference-resolution
The comments at the link above suggest that the bug is caused by asynchronous retrieval of files from source control or the asynchronous solution load when Visual Studio is opened. The choices suggested for fixing the problem are to either turn off the asynchronous solution load or to disable the "get everything on open" option.
There are also suggestions that deleting the .suo (Solution User Options) file in the project directory resolves the problem, but this seems to be only temporary.
The only solution that I've found to work is to delete the Visual Studio cache # C:\Users\<>\AppData\Local\Microsoft\VisualStudio and then running Visual Studio with the /resetuserdata switch. It's a horrible solution that deletes all of your local settings, and resets Visual Studio.
(You can try exporting and importing your settings before and after the surgery.)
Links
(Delete the 2013 cache)
http://blogs.msdn.com/b/willy-peter_schaub/archive/2010/09/15/if-you-have-problems-with-tfs-or-visual-studio-flush-the-user-cache-or-not.aspx
(Fixing the error in 2010, which is slightly different)http://rathodkrunal.blogspot.com/2011/11/visual-studio-2010-error-hresult-efail.html
It's also an open item on connect, if you want to bug MS into fixing it.
https://connect.microsoft.com/VisualStudio/feedback/details/799832/constant-call-to-com-component-fails#tabs
Ran into a very similar issue assisting a colleague. The project had been converted from 2010 to 2013 and was working for most developers. To "resolve" this, we had him close the solution, then delete all of the source control files at the solution level, (vsssc). Once reopening the solution, all was fine.
I've had this issue constantly in different dev environments for the last while. I managed to solve it in one case without using the cache clearing technique by launching component services->DCOM Config. When I did this I was prompted to register a missing key. (didn't quite catch it but something related to EventManagement). Clicked OK and lauched visual studio...hey presto...back in business. Hopefully this advice might catch a few cases out there.
I have a Web Deploy Package that produces an App.SetParameters.xml file along with all the other package files. The SetParameters file has several setParameter nodes that are supposed to update connection strings, but whenever I execute the web deployment script it always reports 0 parameters changed. Looking at the deployed Web.config file shows that they were indeed not updated.
Verbose output of the deploy script doesn't say anything about why it is skipping my parameters; it never even mentions them. However, if I change one of the setParameter tags to a parameter tag it gives me an error:
Error: The parameter 'ConnectionString-Web.config Connection String' has already been defined.
So it is obviously finding that parameter in my Web.config. I am completely confused by why it would just skip parameters like this.
Environment:
Visual Studio 2012
Web Deploy 3.0
Windows Server 2008 R2
IIS 7
This problem was related to the issue raised in this question. Because I moved this solution from Visual Studio 2010 to Visual Studio 2012 all of my Web.config files still had this as their root node:
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
This causes the xpath used by Visual Studio 2012 Web.config transforms to choke and results in the error:
No element in the source document matches '/configuration'
However, this error only appears when building the Web Deploy Package, not when running the web deploy package, so Web Deploy just thought there was no configuration section to update. You would think that no configuration section in a Web.config file would be a problem worth at least warning the user about, but apparently not.
The solution is to remove the xmlns attribute from the <configuration> node in the base Web.config file, publish the package from Visual Studio, and make sure the 'No element in source document' warning doesn't appear in the output anymore. After that Web Deploy should have no problem honoring your setParameter instructions.
I have an Asp.Net website project that builds fine locally with VS2010 and from the command line with msbuild. The problem is its failing on our build server (CruiseControl.net) with this circular file reference issue
/tms/_master/help.master(1): error ASPPARSE: Circular file references are not allowed. [C:\ccnet\working\master\Tms.Rms.Website\tms.metaproj]
/tms/_master/reporting-detail.master(2): error ASPPARSE: Circular file references are not allowed. [C:\ccnet\working\master\Tms.Rms.Website\tms.metaproj]
/tms/_master/mvc.master(1): error ASPPARSE: Circular file references are not allowed. [C:\ccnet\working\master\Tms.Rms.Website\tms.metaproj]
I don't see anything obvious about the way pages/folders/or controls are laid out as suggested in other questions related to this error, and I have zero feedback from VS2010 locally as it doesn't have the problem at all. (it builds ok)
Anyone know how I can track this issue down locally, or what may be the cause of different build results between machines?
Local build environment: vs2010, msbuild 4.0, building as myself
Build server environment: msbuild 4.0, building as ccnet service account (no vs2010 installed or available)
I also have the same version of ccnet setup locally with he same configuration building successfully.
It's worth noting that the circular reference errors above seem to occur on "nested" master pages with the MasterPageFile attribute. e.g.
<%# Master MasterPageFile="~/_master/base.master" CodeFile="help.master.cs" Inherits="_master_help" %>