I am working in C# with Visual Studio 2017. I had previously made some changes to my form, and today when I run the code, the changes don't show up. It appears to be running an older version. Note that when I originally made the changes, it ran fine with the dropdown working.
Here is the edited version:
And here is what it looks like when it runs:
I have restarted VS and restarted my computer, both to no avail. I have searched extensively and can't find the answer.
Is there some setting I accidentally hit? Please tell me it's something obvious and not a weird glitch in the VS matrix.
Thanks!
You were using an old DLL/EXE.
This can happen in a few scenarios, typically if you store your binaries (DLLs built with your project) in source control.
You'd be surprised how many developers get caught out with this. It's often due to being pedantic about EVERYTHING being in source control - including the items you build!
Best thing to do is delete the bin and obj folders from source control. If it's a new project it's often easier to start fresh with a new source control project.
GAC'ing your DLLs is another common cause of this situation.
Related
I've been googling this all afternoon and I found any number of people ask the question, and all of the place a few people would answer it with the same things, and then there's a dozen comments by the rest of the world and the OP about how those answer don't fix it. So I'm going to include what I've tried here, and if your solution is to do one of the things I've already tried, I'm going to be very sad.
I have a solution in Visual Studio 2019 that has a class library, a wpf application, and a setup project (using the setup project extension). The WPF app also references a bunch of assemblies of course, but one of those is from another project I maintain in a different solution. I copy/paste the compiled dll after I update it from its own project to this one. Nothing tricky, everything works.
The problem is the installer. If I build everything and then build the installer, it produces an MSI as expected. If I right click on the project in Visual Studio and choose "Install", everything is perfect.
The problem is after I make some updates to either of the code projects, I then build both and build the setup project, and again if I right click to install it's perfect. If I run the MSI though, it doesn't always update the target files. If I delete the target files it will create them with the new ones, but it won't overwrite the old ones correctly.
AssemblyVersion and AssemblyFileVersion are both being incremented each time and are being kept in sync with the "Version" property of the setup project. I tested with these extensively, the new installer that isn't working properly 100% has updated dlls in it with correctly updated version numbers.
When I change the "version" of the setup, it asks to change the GUID for the ProductCode. I say yes, it changes the code. I have also tested without doing this and that makes it much worse as we all know.
"RemovePreviousVersions" is set to "true" in the installer project
If I right click the project and choose "Install" it seems to be 100% reliable at upgrading the existing installation.
If I run the MSI directly it seems to be 100% unreliable and never gets it right.
Side note, it does seem to usually but not always get the WPF application upgraded and the other project dll I bring in if I remember to update its version, but the class library (which is referenced by the WPF application) almost never works.
Has anyone got this to work reliably?
For all the people finding this in the future, here's the final word:
The build project can be inconsistent, this is well documented all over the internet as I have above. You're not doing anything wrong - it is just inconsistent.
Stop trying to solve it if it's affecting your project and move on (I've had a dozen projects before this one work just fine). The consensus seems to be to use WiX, but I'm not here to discuss the alternatives. Personally I am going to embark on the WiX learning curve though.
I am having the exact same issue/error as this post from yesterday. Similar SO Post
SIDE NOTE...As you can see, I am new and therefore, only have 45 reputation. As such, I could not simply add a comment to the above existing post and had to create a whole new post even though they are the same issue....seems silly. But I digress....
I wanted to provide additional comments in the hopes to get an answer. My issue started suddenly the a few days ago. I made no major changes to references, VS updates, etc... However, when I right click my csproj in visual studio, I get the error and I have to click it five times before it goes away, at which point I finally get the menu.
Again, I have made no major changes BUT I went ahead and confirmed that:
My target version and Min version is Windows 10(10.0; Build 10586). That is the SDK version that I have installed and am using.
I verified that my NuGet updates are complete and that my Microsoft.NetCore.UniversalWindowsPlatform are installed and update to date (5.2.2 as of now).
I do have a reference also to "Universal Windows". This was created automatically when I created my project and I cannot remove this reference but it is there. When I select it, I do see that it is "UAP,Version=10.0.10586.0" so this should be good. I do notice a possible issue here. Again, this reference was created for me and I cannot remove or change it. However, it is pointed to a folder named
C:\Program Files(x86)\Windows Kits\10\References\Windows.ApplicationModel.Calls.CallsVoipContract\1.0.0.0\
Why did the Windows Universal reference default to that folder and only that folder? I am not using VoIP so I wonder why it chose this one? Also, what if I need some of the other references in the References folder?
I created a brand new Windows Universal project and the same error happens on a fresh project.
Please help, it is annoying. Project still seems to build and work fine though.
Thanks!
I found the issue in my case, it was an extension that I added on to Visual Studio provided by SyncFusion (which their installer actually creates 7 or se extensions in Visual Studio). After troubleshooting my issue and doing some of the same things to resolve (repairing .Net, SDK, Visual Studio) I then thought about the error a bit more. While it is cryptic (and has poor english "An Exception has been occured") these are all clues that it could be any of the frameworks that I have installed via extensions as well.
I also had another clue, the issue started happening a few weeks ago, around the time I updated my SyncFusion controls to the latest version.
So, I went to Tools > Extensions and Updates. I went to Installed > All and found all of the SyncFusion items (there are several) and disabled them all. After I disabled them, and restarted Visual Studio, the problem went away!!!
This is a workaround for now. In the meantime, I put in a support ticket with SyncFusion on the issue. I will certainly update this thread when I get a response from them. Also in the meantime, I then went back and re-enabled each of them again, one at a time, to see who the real culprit was. In my case it was the SyncFusion Web Conversion and Migration extension.
If any of you are not using SyncFusion but having odd Visual Studio issues such as this, I suggest doing something similar by going through your extensions and disable any that you added on, starting with the most recent add ons, especially if they were added around the same time you started having the problem until you find the culprit.
Hope this helps!
I'm having trouble with Visual Studio 2015 Pro for one specific solution. The solution is a ASP.Net Web Forms application with 10 projects. The following problems only appear in this solution:
Closing the solution takes 20-30s
Opening the solution takes 1min
VS becomes completely unresponsive while opening/closing the solution
Typing has a small lag (~200ms)
IntelliSense for c#-Code also lags
IntelliSense for JavaScript does not work at all (might be an unrelated issue though)
Opening an .aspx file in designer takes 5-10s
Stopping a debugging session takes 15-30s and VS becomes completely unresponsive during that. Staring the debugging session is actually faster than stopping it.
When I was using VS 2012, these problems did not appear. I got the described problems under Windows 7 Pro and Windows 10 Pro. Reinstalling Windows and Visual Studio did not help either.
For other solutions (Windows Forms, WPF), these problems do not appear. I have also tried to delete the project's *suo file, which is known to cause perfomance issues when it gets too big. Strange thing now is that VS does not create a new *suo file in the project directory. My development machine is surely fast enough to handle the project (a few 100k LOC). I'm not using any 3rd-party plugings like ReSharper. Other things I did while troubleshooting:
Disable code lens
Install all available updates
Cache debugging symbols
I have tried several possible fixes found via Googling, but nothing helped so far. Does anybody have another suggestion what the cause of the problems might be?
Update:
Deleting all breakpoints using the function provided for that fixed some of ther problems. I can now open/close the solution within <5s and starting/stopping debugging now goes smoothly. However, input lag, designer lag and problematic IntelliSense still persist. Deleting contents in "AppData\Local\Microsoft\VisualStudio\14.0" did not help.
I think that many issues can cause this type of problem & you can never give up enough details to help identify these types of issues ...
it could be because of a million difrent things ....
I googled it and found some interesting solutions ....
have a look Here
be sure to check out the comments !
you can try the following to resolve issues in java-script and .aspx files a bit:
Remove unnecessary contents from _references.js file. it should be present in Scripts folder.
Right click on the file and uncheck "Auto Sync Java-script References"
Hope it helps
I am working with winforms, .net 3.5 Visual Studio 2008.
The code is compiling, the winforms designer suddenly stops showing forms,
with different messages, for example
'Resco.Drawing.GradientColor' cannot be converted to type 'Resco.Drawing.GradientColor'
'Method not found: 'Void Resco.UIElements.UIControl.set_TextAlignment(Resco.Drawing.Alignment)'
The variable 'ucMessageBox1' is either undeclared or was never assigned.
Again, the code compiles and runs, and no changes habe been made to the form or usercontrol, that cannot be displayed, since it xold be displayed
Sometimes it helps to clean and rebuild, sometimes it help do delete the .suo file.
Sometimes it helps to shutdown and restart Visual Studio.
Sometimes I do not find a solution but somewhen it works again.
I have two solutions with identical Source code for two Platforms, windows and windows embedded, sometime the same control is shown without problems in one solution but not in the other.
I have this same issue with VS using DevExpress. I find if I close the designer mode and re-open it, it will work. At worse, I restart Visual Studio and appears to fix the problem.
That often happens when I work with Telerik, to resolve the issue I often have to do:
Repair the software library I installed for it.
Remove the reference, then Add the reference to the .dll again.
Ignore the designer mode and simply work in code behind.
Sadly, the last result is where I often find myself. Usually I'll simply code straight in code behind, as all the functionality exist but I don't have to deal with the issue every time I close / reopen Visual Studio. Since all the functionality exist in code behind, just unable to access the designer.
Honestly I'm not sure why it happens, but it happens often enough to where I avoid Telerik.
I am having great problems running the application in the debugger from Visual Studio 2008.
When I'm using vshost.exe, it says:
And when vshost.exe is turned of, it simply states:
Interesting thing about it is that when i do use vshost, debugger is actually started and breakpoint is hit on the first line of the Main().
I tried:
rebuilding the project(s)
removing .ncb, .suo, .user for the projects
repairing Visual Studio 2008
changing the build architecture for the project
... no help there...
Any experience in (trouble)shooting that?
More info: some projects DO work, and one that I have to work on, does not.
I have some ideas such as:
trying to create NEW project, add thing by thing to it and see at what point it will start to miss behave
work it other way around, delete project by item by item to see when it will (if it will) be working OK again.
EDIT (for google, as I see that there are many similar questions on the web):
Errors:
Error while trying to run project: Unable to start debugging.
and
Error while trying to run project: Unable to start program '....\PlayKontrol.exe'
Try upgrading your Visual Studio to Service pack 1, if you haven't already.
Did you restarted your computer? You never know how windows will react to that :).
Also be sure there aren't any keys stuck, like the ctrl or windows key.
Note that the key does not have to be visually stuck, it can be stuck for visual studio and not for the explorer.
The most common source of sudden problems like this is corruption of one of the data files that vs uses to cache information between builds.
You've tried a clean build, but this won't delete everything. A real clean build is: quit vs, delete bin, obj, debug, release folders, delete all generated files in the root - primarily ncb. Do the same for any locally built libraries that you're project references.
The easiest way to do this is if you have the code in source control, as you can rename away your entire code folder and then force a get of all the source.
You often need to do all of these things in one hit to clear the problem.
Less frequently, a reinstall of vs will sort things out (although this sounds unlikely in your case if it is only one project that breaks)
Also think carefully about anything you might have installed just prior to it failing... And remember that some install effects may not occur until the next reboot so it could be days ago. A particular cause of this are automatic windows updates and trial versions of things like the vs 11 beta.
You might try running the application from outside of VS, but have a line of code that looks like this: Debugger.Launch(); where you want your first breakpoint.