Visual Studio 2015 designer.cs file gets all custom components removed - asp.net

I am using Visual Studio 2015 on an ASP.net WebForms project. When I save a .aspx page the .designer file gets regenerated but it removes all references to any custom component on the page (ex: ) and leaves intact the references to any default built-in .net components (ex: ).
The problem is only happening on my machine. The other team members do not have this issue so I know there is not something wrong with the project itself.
One thing I have found is that any time I add or remove an extension in visual studio, it shows the Restart button. When I click that button to restart VS, then the problem with the designer files goes away. But as soon as I manually close VS using the X at the top right, and restart it, that is when the problem comes back.
I've tried with and without using Run as Administrator with no luck either way.

Related

Visual Studio 2015 codelens issues when using Typescript

I'm using Visual Studio 2015 Enterprise RTM.
When creating an ASP.net 4.6 web application using the Web Api template, I noticed as soon as I add a TypeScript file, the codelens indicators stop working.
I tested this on a new installation, with no extra extensions installed, as well and tried other asp.net 4.6 templates.
When running in safe mode the problem doesn't occur.
Steps to reproduce:
Set the framework to 4.6
Create a web application by using the web api template.
Change authentication to no authentication
Open the webapiconfig.cs in App_Start
The codelens indicator on the register method should say: 1 reference
Add a typescript file called app.ts (doesn't really matter) in the scripts folder, tit may remain empty
The codelens indicator in the webapiconfig file should still say 1 reference
Close Visual Studio
Reopen Visual Studio and open the solution
Check the webapiconfig file, the codelens doesn't show references anymore or on any other file
Any idea on how to debug codelens or does anyone have this problem as well?
I work for the visual studio team that is responsible for codelens references indicators. I can confirm that this is indeed a bug in VS2015 where codelens references stop working when you add typescript files to your project or typescript projects to your solution :( Unfortunately, we missed this bug for RTM. We're currently actively investigating this bug. At the moment, I am not aware of any workarounds for this problem. I can post an update when we have more information to share on this bug.
I may have found a workaround that seems to do the trick for me:
So, I have a solution with multiple projects, only one of which has TypeScript files.
I just unloaded the project, cleaned + rebuilt (some restart to Visual Studio at this point may help + close all opened files), then loaded again, cleaned and rebuilt and now CodeLens shows my references (again, close all open files).
Note that until this bug is fixed, you may have to do this each time you open VS.
Hope this helps!
EDIT: If you only have a single project, then exclude the Scripts folder from the solution, clean, rebuilt, close Visual Studio then open it again. Now you should have the references back. Simply include the folder again.
Best of luck!
in my case references start working after uninstalling vssonar extension, vs2015ent

Visual Studio 2013 saving and building before publishing

I recently formatted my computer and then reinstalled visual studio 2013 (I previously had VS 2012). I used to be able to right click on a specific aspx page and then publish that individual page with ought having to publish the entire site. Now, I need to publish the entire site just to reflect the change on one page and it's also not saving on publish. So, I believe what I'm asking is how to automatically build and save when I try to publish an individual page? Thanks, Chris.

Opening web.config file causes Visual Studio 2010 Ultimate to hang and crash

Situation:
I installed Visual Studio 2012 on top of my previous Visual Studio 2010 Ultimate. I uninstalled VS2012 shortly thereafter along with all SQL 2012 database junk and yadda yadda. Everything in VS 2010 seems to be good, but when I try to open my web.config file VS hangs indefinitely.
Tried:
(1) Downloading and replacing the dsref80.dll that gets overridden by VS2012
(2) Uninstalled all VS extensions, including NuGet
(3) Created new website and web.config file. Problem persists
Question: Does anyone have any other ideas about what could cause the web.config file to cause VS2010 to hang and crash after clicking on it?
I figured it out. For some reason the web.config file was set to open with source code editor by default and not the HTML editor.
For anyone else who runs into this issue, the answer is simple.
Right-click the web.config file ---> Open with ----> Highlight HTML Editor ---> Set as Default.
Update (Dec, 2013): Although I was able to access the web.config file using the method mentioned above, I later realized that it was more of a Band-Aid than a solution. Using the html editor causes a lot of validation warnings and renders intelliSense useless. The correct solution is to run the repair option from the Visual Studio 2010 install DVD, that fixes everything.

breakpoints in code behind not hit

common problem I guess, but no solution has worked so far:
my breakpoints (asp.net 2.0) get hit nicely in "backend" assemblies but not
in the code behind.
i can even see the
<% Response.CacheControl="no-cache"; %> line being hit in my asp.net master file
but still not the code behind.
I'm using VS 2005, windows 7 32 bit.
Any idea what else could I check?
If your code file is newer than the compiled version that is being run against (on the web server, whether it be IIS or the dev server), breakpoints will not be hit (the red circles will be hollow).
Try doing a clean / rebuild and see if that works.
EDIT:
I just noticed something in your last comment; you said you are attaching to the asp.net process. To which process are you attaching? It should be w3wp.exe.
My problem ended up being that I'd created a new configuration for the project, but that none of the debug properties on the project were set for it. So this is what I had to do:
Right click the web project and select Properties.
Go to the Build tab.
Click Advanced.
In the dialog, ensure that in the Output section, Debug Info is NOT set to none.
I'm guess there is a problem in loading the symbols for the page, and hence the breakpoint is not hitting,
try this
1 - While debugging in Visual Studio, click on Debug > Windows > Modules. The IDE will dock a Modules window, showing all the modules that have been loaded for your project.
2 - Look for your project's DLL, and check the Symbol Status for it.
3 - If it says Symbols Loaded, then you're golden. If it says something like Cannot find or open the PDB file, right-click on your module, select Load Symbols, and browse to the path of your PDB.
4 - I've found that it's sometimes necessary to
stop the debugger
close the IDE
close the hosting application
nuke the obj and bin folders
restart the IDE
rebuild the project
go through the Modules window again
Once you browse to the location of your PDB file, the Symbol Status should change to Symbols Loaded, and you should now be able to set and catch a breakpoint at your line in code.
hope it helps !
Answer source
Ugh. In my case I had mapped the right folder in IIS, but the application was set on IIS Express.
So the correct assemblies where loaded when I went to the URL, but the application was attached to a IIS Express version that never got any hits.
In my case I updated my repo from Git and the Project changed from Local IIS to IIS Express (Project > Properties > Web tab). This somehow messed up my configuration and I was not able to debug.
My problem was fixed by setting it to "Startup Project"
Solution Explorer -> Right Click on the project -> Set as StartUp Project
or
Menu bar -> PROJECT or WEBSITE -> Set as StartUp Project
Just to help others who come across this question, I too had this issue where none of my breakpoints where being hit.
It turned out that the project was originally created in Visual Studio 2015. I have 2008, 2010, 2015, 2017, 2019 installed. I accidentally opened it in 2017 and then this issue occurred. Opened it back up in 2015 and back to normal.

Visual Studio 2008 doesn't create *.refresh files for external DLL references... what am I missing?

I've got a question about something that's just been irritating me.
A colleague and I are building a support framework for our current client that we want to reference in other projects.
The DLL we want as a reference in our project would be an external reference. We're adding it by doing "Add Reference...", then browsing to the location of the .dll. What I want Visual Studio to do is only add the .xml, .pdb, and a .dll.refresh file, but instead it copies the actual .dll (and .xml and .pdb) into the bin.
When we rebuild the framework project, the other project that uses its .dll gets all out of whack until we drop and re-add the reference. Everything I've read online says that VS2008 is supposed to create the .dll.refresh files for you, but it never does.
Any ideas? Am I missing something or doing something wrong?
At this point I'm ready to add a pre-build event to simply copy the framework .dll into my bin, but the .refresh file seems like less of a hassle if it would just work.
Thanks.
UPDATE:
This SO post describes the actions that are supposed to be happening with the refresh files.
So it turns out that .refresh files are only created for Web Site projects, not Web Application projects.
The problem stems from Visual Studio having trouble deleting lock files for DLL references over 64kb, a problem supposedly fixed in VS 2010.
The current workaround is to close and reopen the solution or to unload and reload the project containing the references.
If the Projects are in the same Solution and you add a "Project Reference" that should solve your problem.
You can try to add references another way.
Add reference
Choose tab Browser (Not tab Project)
Choose *.dll that you need
I have tried it and been successful.
If you choose tab Project --> there are no *.dll.refresh added

Resources