Visual Studio 2019 Always run OLD version code - c++

I tried many things that searched on google.
listing I had.
Project -> Property -> Debugging -> Debugging = Auto
Build -> Configuration Manager -> Check OK "BUILD" option ( Also I checked solution platforms and configs. )
Tools -> Option -> Build & Run -> Always Build. and Uncheck "just startup project & dependencys"
Those are what I did to build every pressing F5.
It doesn't work. even though I restart computer or visual studio.
What should I do for it?
ps. My Project is Visual Studio C++ (Empty)

I had the same problem. Looking for days but finally i found a solution.
The first step is to completely delete Visual Studio (installer as well,yes) and then install it again.This time check on "general options" and not "recommended for C++" in the beginning of the installation(Its where you choose the color of the IDE).I know it's sounds..weird.Let me know if it worked for you too!

This may be due to your visual studio having settings that launch the old working code if the current code has some issues.
You could change that setting using the below steps:
Tools > Options > Project and Solutions > Build and Run
Do below settings on the left pull-down menu
On Run, when build or deployment error occurs > Do not launch

Related

Visual studio compiling failed without any errors [duplicate]

I have a WebApplication which contains reference to WCF services.
While building using Visual Studio 2010, Build fails without any error or warning. However building the .csproj using MsBuild is successful.
Can't figure out what should I try in Visual Studio, to resolve / diagnose the issue. Can you please help out?
I find out that the build has been failing,
From text displayed in status Bar.
From output window:
========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========
The output tab includes configuration details.
------ Build started: Project: <projectName here> Configuration: Debug Any CPU
I noticed that if "Build + Intellisense" is selected in the Error List, it causes the error messages to be swallowed.
Change this option to "Build Only", and all error messages will be displayed:
I don't know if this is a bug in Visual Studio or what, but it certainly revealed hidden error messages that were the key to pinpointing the failure for me.
Some, like Richard J Foster, have suggested increasing the "MSBuild project build output verbosity" setting to "Diagnostic" (the highest possible option), but this didn't solve the problem for me, as Visual Studio appeared to be suppressing the error message(s) themselves.
As an alternative, you may try to use the raw output messages from the "Output" tab, which haven't been filtered by Visual Studio. Either do an in-place search for the strings "error" and/or "failed", or copy all of the output to your favorite text editor and do a search there.
To ensure that the Output window appears each time you do a build, you can go to Tools → Options → Projects and Solutions → General, and ensure that the option "Show Output Window when build starts" is checked.
As an additional troubleshooting step, it is also possible to build the project from the PowerShell command line by running dotnet build. This will show you the complete build output, including any errors that Visual Studio may be hiding.
I just ran into a similar situation. In my case, a custom action (from the MSBuildVersioning package available on Nuget.org - http://www.nuget.org/packages/MSBuildVersioning/) which appeared in the csproj file's BeforeBuild target was failing without triggering any error message in the normal place.
I was able to determine this by setting the "MSBuild project build output verbosity" (in the latest Visual Studio's Tools tab [Path: Tools > Options > Build and Run]) to "Diagnostic" as shown below. This then showed that the custom action (in my case HgVersionFile) was what had failed.
Here are some things that you can try:
If your solution contains more than one project, try building each project one at a time. (You may even want to try opening each project independently of the solution.)
If applicable, ensure that all of your projects (including dependencies and tests) target the same version of the .NET Framework. (Thanks to user764754 for this suggestion!)
Tip: Check Tools → Extension and Updates to ensure that your packages are up-to-date.
Ensure that all dependency projects are built to target the same platform as your main project.
Try restarting Visual Studio.
As suggested by Bill Yang, try running Visual Studio as Administrator, if you aren't already. (If you are already running Visual Studio as Administrator, perhaps try the opposite?)
Try restarting your computer.
Try "Rebuild All".
Run "Clean Solution", then remove your *vspscc* and *vssscc* files, restart Visual Studio, and then "Rebuild All".
As suggested by Andy, close Visual Studio, delete the .suo file, and restart Visual Studio.
As suggested by Arun Prasad E S, close Visual Studio, delete the .vs folder in your solution directory, and then re-open Visual Studio. (This folder is auto-generated by Visual Studio and contains cache, configuration settings, and more. More details can be found in these questions: Visual Studio - Deleting .vs folder and https://stackoverflow.com/q/48897191.)
As suggested by MrMalith, close Visual Studio, delete the obj folder in your solution directory, clear your temporary folder, and then re-open Visual Studio.
Delete the hidden .vs folder & restart Visual Studio. That worked for me.
I want to expand on Sasse's answer. I had to target the correct version of .NET to resolve the problem.
One project was giving me an error:
"The type or namespace name 'SomeNamespace' does not exist in the namespace 'BeforeSomeNamespace' (are you missing an assembly reference?)".
There was no error in the Error List window but the assembly had a yellow warning sign under "References".
I then saw that the referencing project targeted 4.5.1 and the referenced project 4.6.1. Changing 4.6.1 to 4.5.1 allowed the overall build to succeed.
Nothing was working for me so I deleted the .suo file, restarted VS, cleaned the projected, and then the build would work.
I tried many things like restarting Visual Studio, cleaning and rebuilding the solution, restarting the PC, etc., but none of them worked for me. I was finally able to solve the problem by doing the following:
First of all, make sure all the projects in your solution (including tests) are targeting the same .NET version. Then:
Save pending changes in the project and close Visual Studio
Find the exact location from file explorer and find "obj" file and open it,
Then, delete all the included files (some files won't remove, it doesn't matter, just skip them).
Use run command (by pressing Windows Key + R) and type "%temp%" and press enter to find temporary files.
Finally, delete them all.
On other possibility is that Visual Studio needs to run as Administrator, this might be related to deploying to local IIS server or other deployment need.
Just for the sake of completion and maybe helping someone encountering the same error again in the future, I was using Mahapps metro interface and changed the XAML of one window, but forgot to change the partial class in the code-behind. In that case, the build failed without an error or warning, and I was able to find it out by increasing the verbosity of the output from the settings:
In my case (VS 2019 v16.11.20), disabling Text Editor->C#->Advanced->Enable 'pull' diagnostics in the options solved the issue.
Double check for _underscore.aspx pages in your project.
I had a page and code-behind:
`myPage.aspx` and `myPage.aspx.vb`
when building the project, I'd get errors on the .aspx.vb page stating that properties defined on the .aspx page didn't exist, even though the page itself would build fine and there were NO OTHER ERRORS showing in the output (even with diagnostic level build output).
I then came across a page in the project that was named the same thing but with an underscore: _myPage.aspx - not sure where it came from, I deleted it, and the solution built fine.

Visual Studio 2017 Build Configuration Missing

I have Visual Studio 2017 Community 15.7.2 installed. The build configuration drop down options disappear. I have been having Problems with the build configuration disappearing on my work machine (Visual Studio 2017 Enterprise 15.8.2) as well.
If I create a new project File -> New Project -> Web -> ASP.Net Web Application (.Net Framework).
The build configuration option shows up. Then if I click on a controller class e.g. HomeController.cs. The option clears out.
The option will show up again after changing "Show output from" under the Output window. If I bring up a .cs file again. The build option disappears:
Is this now a normal behavior in Visual Studio? I suspect a bug in Visual Studio and have been updating more often than usual in attempt to fix it.
The latest update to Visual Studio Community 2017 (15.8.4) did not fix the problem.
Go through each of the Tools -> Extensions and Updates and disable an extension and then restart Visual Studio. Start with ones that aren't created by Microsoft.
Repeat this until you have tried all the extensions.

How to enable IntelliSense for C++ in Visual Studio 2015

I've just installed VS2015 for C++ development, however traditional hot keys like ctrl+space or . or -> don't show the IntelliSense window.
Somewhere on the web I found that I needed to open the IntelliSense Manager from the Tools menu. But that's not in my Tools window.
In addition, I reviewed related items in my IDE settings and found a Text Editor -> C++ -> Advanced - IntelliSense section with a number of settings, including Disable IntelliSense, which is True in my setup. The problem is that all settings in this section are readonly (not editable).
How do I fix the problem?
VS2015.2, fresh install. No previous installation on this host.

Configuring target platform for my Visual Studio C++ project

I have a visual studio solution with three projects. I want to configure them all for x64 (as I have a X64 machine). I have created the x64 configuration as you can see in the following image.
The x64 configuration can be applied to the first and the third project. It lists in the drop-down box like shown in the following image.
The project in the center is dependent on the project on top and below it, both. But, this project alone does not show x64 in the drop down. Here is the image:
Can anyone tell me what is the problem and how to solve it...
Click on <new> and add X64 and choose to copy its settings from Win32 then change the settings that you want by yourself.
I found out my problem. I had created the configuration X64 from one of the projects. I had to delete the configuration from the other projects and create it again in the other project and only then, it allowed me to set the configuration for that project. When this deleting and re-creating the configuration was done for each project, it worked fine. If only the properties of one project did not show the configuration created in other projects, or if showing, it had allowed to set that configuration to other projects too, then the problem would not have come. I think this is a bug in visual studio.

LNK1113: invalid machine type 0x1C0

While building the project in VS2012, I'm getting the linking error as
LNK1113: invalid machine type 0x1C0
I'm not sure where to check and what would be the error. Any help would be appreciated.
Thanks
two minutes google for 'how to set module machine type in visual studio'
resulted in the following info, found at:
<http://stackoverflow.com/questions/3563756/fatal-error-lnk1112-module-machine-type-x64-conflicts-with-target-machine-typ>
Check your properties options in your linker settings at:
Properties > Configuration Properties > Linker > Advanced > Target Machine.
Select MachineX64 if you are targeting a 64 bit build,
or MachineX86 if you are making a 32 bit build.
Select Build > Configuration Manager
from the main menu in visual studio.
Make sure your project has the correct platform specified.
It is possible for the IDE to be set to build x64
but an individual project in the solution can be set to target win32.
So yeah, visual studio leaves a lot of rope to hang yourself,
but that's life.
Check your library files
that they really are of the type of platform are targeting.
This can be used by using dumpbin.exe
which is in your visual studio VC\bin directory.
use the -headers option to dump all your functions.
Look for the machine entry for each function.
it should include x64 if it's a 64 bit build.
In visual studio, select
Tools > Options from the main menu.
select Projects and Solutions > VC++ Directories.
Select x64 from the Platform dropdown.
Make sure that the first entry is:
$(VCInstallDir)\bin\x86_amd64
followed by $(VCInstallDir)\bin.
Once I did step 4 everything worked again for me.
The thing was I was encountering this problem on all my projects
where I wanted to compile towards a 64 bit target.