Changes in Visual Studio 2008 not 'taking' - c#

I've been consistently having a problem where changes I make to my web form or code-behind doesn't get recognized by the debugger until I quit visual studio and delete the "root" folder located in C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files.
It's very cumbersome and greatly decreases my productivity. Any help would be greatly appreciated. I've tried reinstalling visual studio, using visual studio 2010 and a variety of other proposed solutions.
Thanks very much
Update: On a hunch, I moved the project to the C: drive. (It was residing on a network drive)
No difference.
I added a control as a test and ran the program. Label shows up. Deleted the label. Ran the program. Label still there. Rebuilt the program; re-ran. Label still there.

This sounds like your are working on a compiled website project but have IIS running off the folder which contains the project you are working on in Visual Studio
When running like this there are strange issues that can occur where the site both has built classes in the Bin folder, as well as having dynamically compiled dll's in the ASP.Net temp folder and it really depends on the first line of your ASPX pages.
make sure the header of your aspx pages have CodeFile='pagename.aspx.cs if they are meant to be dynamically compiled and CodeBehind='pagename.aspx.cs is they are meant to be compiled by Visual Studio. You can't mix and match these two

Related

Why does Visual Studio 2022 suddenly stop showing errors?

As stated in the headline, Visual Studio 2022 suddenly stopped showing errors (and also I can't find public method and variables but that's another question).
I am working in Unity and suddenly it just don't want to cooperate anymore.
I tried closing the application and unity all together and restarted my computer, and nothing worked.
At the top of your screenshot you can see "Miscellaneous Files". This means that the file is not considered to be part of any project.
To see errors and IntelliSense, VS requires source files to exist within a project so that it knows:
What references exist (packages, assemblies, target framework)
What version of the language is being used
Various properties that influence analysis/analyzers
So for some reason your file is not considered part of a project. We can't see your Solution Explorer, so it's not clear why that might be. Most likely you've opened the file via "File | Open". Make sure you create the file within a project, or add it to a project.
One of the endless joys of working with Visual Studio are random inexplicable times it stops working the way it should. Usually these steps work:
Close VS completely
Ensure all bin and obj directories of all projects are cleared
In the same directory as your solution should be a hidden .vs directory. Delete this.
Reopen VS and your solution. You should be back to a normal state within a few moments. Sometimes a "Rebuild All" can accelerate its return to normality too.

how to make a standalone exe file

I started learning c# a couple days ago and want to send my first program to my friend but as a standalone exe file that can be shared through google drive.
I've found several solutions but I coudln't understand any of them. Is there a simple solution to compile an exe file or a standalone app in visual studio 2019 that would just work when you open it
One annoying thing with .NET Core is that when you build it in Visual Studio it makes lots of separate files, which is annoying for portability.
A fix to this is to right-click on your project in Solution Explorer and click Publish. Select Folder Profile, give it a name and save it.
After that, you will need to edit the target runtime option, and set it to win-x86. After that, you should see a dropdown box at the bottom of the dialog, expand it and check 'Produce a single file'.
Then you can hit Publish and it should produce a single file.
NOTE: This does not work in .NET Framework, only .NET Core.
All you gotta do is simply build the project within Visual Studio, once that's done. Go to your projects folder and go into bin/Release (or Debug if you've selected debug build)/myprogram.exe. It should make a standalone .exe file!
Maybe this could also help you.
Official Documentation: Compiling Building in Visual Studio

What are these file types that Visual Studio is creating in a WinForms project folder?

Today I just happened to have my windows explorer opened while working on a Form in a C# WinForms project opened in Visual Studio 2015; it was displaying the contents of the project's UI files.
At one point I noticed these odd files being created in the directory
What are they for?
After I noticed them I went to take a better picture than the one provided and went to sort the file name column, they then disappeared from the folder and I have not seen them since.
Visual Studio does a lot behind the scenes when you're building or doing other things, including auto-generating weird looking temp files like these.
Looks like these are temp files that you aren't supposed to see. But you had that path open in your windows explorer and it didn't refresh and clear them like it's supposed to.
Basically, don't worry about it. Those files are always getting generated and deleted and you just don't notice.
Sorry I can't point you to a helpful resource, as I couldn't find anything about this on Google.

change output path of MVC x64 project

Ever since I've changed my MVC 4 project output path,
any changes I make to my Controller are not reflected.
When I try to debug my Controller with a breakpoint, it doesn't hit and I get
The breakpoint will not currently be hit. The source code is different from the original version.
I'm using Visual Studio 2015
UPDATE
So I've deleted the old bin folder and re-run the application. I've got the following error
I've followed the solution suggested in this post and now I get
Any ideas?
Whenever I encounter issues like this, I do the following:
close Visual Studio
stop the IIS webapp/website (if not running on IIS Express)
delete bin and obj folders
start Visual Studio
rebuild
This usually helps with all kinds of issues that sometimes occur.
It seems that there's two different version of binaries at your project. By deleting the binaries, you might find out what the real issue is.

Do I need the bin\debug\appName.vshost.exe and appName.vshost.manifest in my SVN code repository?

I am building an application which is based on a sample application,
written in C# on .NET 2, and is built on VS2008. This application is mostly a wrapper for a COM application.
However I compile it in .NET 3.5.
The sample application came with the following files in it's bin\debug:
appName.vshost.exe
appName.vshost.exe.manifest
I noticed that I can delete the files and VS re-builds vshost.exe, and the vshost.manifest file appears with modification date the same as the deleted file as if VS has copied in from somewhere.
My question is, should I put this files in my SVN code repository?
Those two files you list implement the Visual Studio "hosting process". It is a hosted version of the CLR, designed to improve the debugging experience. It takes care of some security issues, the most visible side-effect is that it redirects output written with Console.WriteLine() in a GUI app to the Output window.
These files are not part of your project and do not get deleted when you use Build + Clean. In fact, you cannot delete the .exe file, it is always running while you've got the project opened in Visual Studio. You can disable the hosting process feature with Project + Properties, Debug, scroll down, "Enable the Visual Studio Hosting process" tick. There's no compelling reason to do so.
There's no need to check these in, Visual Studio re-generates them when you check-in a project and load it in VS. In general, you never need to check anything in from the bin subdirectory, its content is always re-created by building your project.
Everything in the debug (or release) folder is generated. Everything that's generated shouldn't be checked in.
When in doubt, just make a fresh checkout to some other folder (or even machine), and try to build from that. If something is missing, this will find it.
I do not think you should. They are for VS use only.
Here are the files I ignore when creating C# projects. You really only want to store the source code in the repository and not the outputs. Similarly you probably do not want to store the user based information that goes along with VS solutions.
*.csproj.user
*.suo
bin (folder)
obj (folder)

Categories

Resources