Code changes are not included to build- Visual Studio 2013 - visual-studio

I have recently moved to Mac and am developing using Visual Studio 2013 from Parallels. I have pulled a project from BitBucket repo using Sourcetree.
Now any code changes I make do not translate to any changes. For example, I can comment out all Start up routines and project works fine (just like before commenting).
In addition, all breakpoints are displayed as empty balls with an exclamation mark on them (The breakpoint will not be hit. The source code is different from the original version).
I tried cleaning, rebuilding, deleting obj / bin directories to no avail.

Usually the remark 'The source code is different from the original version' is true.
The only hint is 'Parallels' however that should not be a problem. A few guesses:
Are you running a web project with ISS development host? It could run your site from another folder, however VSS will attach to this instance.
Do you have build output errors (See the errors tab). If so, check whether the setting 'Run last successful build' is enabled. This could disable running your unexpected binaries.
Is there a overridden entry point for debugging? It could be a precompiled version is included in the sources or from some other location. In this case deleting obj/bin folders won't work.
Just let's make sure this is not related to Parallels. I personally use Fusion with Unity but I expect similar tech. Is it a Bootcamp installation? In that case try to boot native and find out whether the problem still exist.

Related

Visual Studio (Community 2019) throwing errors which should be warnings regardless of settings in one project only

A couple of weeks ago I cleared the NuGet cache in Visual Studio... this broke everything for some time as it would not automatically restore all the NuGet packages for some reason.
After a lot of effort and manually restoring stuff, I have now got most projects in my (quite large) solution working, except one.
I am in the process of moving most of my code from .NETFramework projects, to .NETStandard and the websites to .NETCore, that in itself is a headache and may/may not be related to the problem, but I don't think so.
Anyway, this one project, which is a .NETFramework (4.7.2) web application and references many other projects in my solution, will not build properly.
Each time I build it, I get thousands of stupid errors from MSBuild, see the screenshot (ignore the top 4,they are genuine!). These are all errors which should be warnings, or ignored.
In the Project settings page I do NOT have "treat all warnings as errors" checked - in fact, in an effort to fix this, I have turned warnings off altogether as well.
The weird thing is, that if I build every individual project in the solution first, usually twice, and then build this one with out touching anything else, it then will build and launch in IIS (or publish)
So the site is actually working but something is wrong in MSBuild or VS that is breaking it.
I have tried running a Visual Studio repair, but that made no difference either.
EDIT also, it only does it on one PC, if I load the same solution onto my laptop, it will all build fine.
And from some of the errors, if seems that the you should change the Assembly Name of the SAM project to Sam. It is quite strange. Not sure whether you have install some extra Code Analysis extensions on your current PC but other PCs works well.
So please try the following steps:
Steps
1) disable any third party installed vs extensions under Extensions-->Manage Extensions-->Installed
It needs a restart.
2) run update-package -reinstall under Tools-->Nuget Package Manager-->Package Manager Console
3) close VS, delete .vs hidden folder under the solution folder, every bin and obj folder of the projects under the solution.
Besides, you could use devenv /safemode to start a initial VS without any third party tools to test whether the issue happens.

Visual Studio: Syncing Projects with OneDrive and "Having the mark of the web"

I develop a few small projects in Visual Studio solo and for my needs using a repo like GitHub or Azure Repos just seems a little over the top. I therefore save my projects to OneDrive and develop my projects and when ready to publish and move onto the next build, just copy the existing project directory for version control and start work on to the next version.
However quite often I get stung when building projects
Couldn't process file <file>.resx due to its being in the Internet or Restricted zone or having the mark of the web on the file. Remove the mark of the web if you want to process these files.
I then have to copy the director out of OneDrive to an unsynced area such as C:\Temp and it builds just fine but then has the issue of remembering to copy back my modified project once done. There seems to be no clear cause of it and the file properties does not have the usual 'Unblock' option:
Has anyone come across this with OneDrive, or any suggestions as to why it's happening? I'm sure the main suggestions would be use a repo solution but this method works just fine for me other than this issue so I'd ideally like to get a solution using OneDrive.
Edit: To confirm I've added my OneDrive path into the Visual Studio trusted locations area and tried adding file://[pc-name] into my local intranet trusted addresses area without any success.
My problem is IDENTICAL to yours. I have tried adding the pc to the safe sites list, I've tried adding to trusted location, I don't have the unblock checkbox that many people mention, I also tried using a powershell script to unblock the file. No luck. The only solution was to do a repair of Visual Studio. That fixed the issue for me so that it stopped happening.

Visual Studio 2010 F5 Debugging C++ is not Rebuilding

I have a Visual Studio 2010 Ultimate C++ project (not managed or .NET). When I press F5 (i.e., start debugging), I want it to save all the files, rebuild those that changed, link the whole thing, and then run. Instead, it appears to use the last build. Thus, when I try to step into a function or something, I get the following error:
Based on my research, I have verified these options, the first three of which are in the Options dialog (can be reached under "Debug->Options and Settings"):
"Projects and Solutions->Build and Run->Only build startup projects and dependencies on Run" is checked. Some research indicated that it should be unchecked, but in my case I actually do only want it to rebuild the startup project. For what it's worth, I've tried unchecking it, with no effect.
"Projects and Solutions->Build and Run->On Run, when projects are out of date:" is set to "Always build".
"Debugging->Edit and Continue->Enable Edit and Continue" is checked, though it's greyed out.
In the Configuration Manager ("Build->Configuration Manager"), all solution configurations and platforms have their "Build" checkbox checked.
I have also tried deleting all Debug and Release directories as well as the .sdf and ipch directory.
For completeness, I suppose I should mention that I'm using precompiled headers, though I kinda doubt it matters.
[EDIT: I should note that it only seems to be one file (a .h file) that's doing it. I tried renaming it and recompiling, and also removing it from the solution and adding it back in, but it didn't work. ]
I was able to bring my solution back into the right state after deleting all .suo and .csproj.user files. Answer led to this solution. Hope this saves someone time.
I fell into this state after installing Ultimate over Professional and running profiling tools.
Once I had similar problem with my C# project and I think I have tried every possible suggestion available on internet but none worked and then this is what I have done:
Created an empty Project
Added startup function to verify that it does not show any error
Imported all my source code manually one by one
So, Yes, it was the solution. You already have done a lot so I would say you can get lucky by trying here and there however having a new project and importing your individual source file would be faster.
Another solution could be that switching the platform. I noticed that when I when to project properties, the new project I had just created had a platform of 'win32' and my other projects in the same solution had it set at x64. After I switched my project to x64, everything worked just fine. This worked for my interop(C,C+, C#) project and hopefully works for other projects as well.
I have successfully resolved it, try the following:
remove all temporary and intellisense files
remove all project from solution and then add them back(most important)
check projects 'Frameworks and References' to ensure they are valid

Visual Studio / TFS 2010 / Get Latest / Compile Fails for some not for others with Reference Error

setup:
all development being done on virtual servers (Win Server 2003)
all compiles being done in VS 2010
all code checked into TFS 2010
We are migrating our solutions from VS 2008 to VS 2010. I created a MAIN branch folder for containing our converted VS 2010 projects. I then branched over and worked through getting projects migrated from 2008. The compiles were (eventually) successful. Another developer was working through other projects on the same branch.
We then got all of these projects compiling also through TFS Build 2010.
This is our MAIN branch. Another developer then created a DEV branch folder and branched all of the solutions from the MAIN branch to the DEV branch for ongoing development.
Much to our surprise, we found that though we could compile the code if we did a get latest on the MAIN branch, when we did a get latest on the DEV branch (supposedly the same code), some of us (we'll call them the unlucky developers) got a slew of errors having to do with a reference to a project contained in the solution. But two developers (lucky) had it compile just fine. When the two unlucky ones compile the individual project (the one causing the reference error) it builds fine, but when we build the solution or the referencing project, it fails with the reference to that project.
We tried wiping out our workspace and doing a get on the code fresh - no joy.
The lucky person who created the branch did the same (deleted their workspace, did get latest and ran a compile) and it still compiles. We then had a developer that hadn't been involved in the migration do a get latest and run a compile. Their compile ran just fine too! This led us to believe that it must be the computer.
So then we had one of the unlucky developers log into one of the lucky developer's virtuals and perform a get latest and build using their own workspace. This also failed. So this virtual has one workspace under one user that succeeds, and one under another user that fails to compile for the same get latest on the same code.
Then... we detached the working workspace from the lucky developer's virtual and one of the unlucky devs attached to it (no get, just compile what's there). That compiled fine.
So it feels like we may have some sort of characteristic attached to us unlucky devs that are causing our Gets to be different. One difference I just realized is that we two unlucky ones have shelvesets that we saved in TFS in the 2008 versions (but under TFS 2010).
OK, Then... the same unlucky developer wiped out the lucky one's workspace by deleting the files and then performed a get specific / latest / both force overwrite switches turned on. This compiled successfully!!
Then he went back to his original virtual machine. He deleted the files in his workspace, and did a get specific / latest / both force overwrite switches turned on. This compile again failed!
We're running out of ideas...
Sounds like the (unlucky) developers may have custom workspace mappings (determines which folders in TFS are checkedout where on the hard disk).
View -> Team Explorer -> Source Control -> Click the dropdown on Workspace and select Workspaces...
Delete all the workspaces there (or at least verify them).
Create a single new workspace and checkout at the root level (to keep project references intact)
Well we got bit once again. The issue had to do with the length of the path to the source code. Of course there is no indication of this in the actual error. This is probably the 8th time I have run into this. It is frustrating while trying to keep namespaces meaningful to constantly have to trim these paths.
We had dismissed this possibility, because the names of the developers who were able to compile the code were longer than the two who couldn't, and the names are in the path of the workspace by design so that multiple developers can work on the same virtual machine as needed.
I believe I found out why. I had my compile set to "Mixed Platforms" and the ones who could compile were set to "Any CPU" Maybe this was in the path.
The solution was (once again - this is getting really old) to move the project down a few folders instead of containing it where we had hoped to. This reduced the number of characters in the path and the compile ran just fine. Ugh.

Visual Studio 2010 Debugger jumps around

I have a simple C# Winforms application. It isn't multi-threaded (yet). When I debug it and step through the code at work, it debugs just as expected with the debug cursor moving line by line. But when I try doing this at my home computer, it behaves very erratic. The cursor will randomly jump to an unrelated line of code in the middle of another method that hasn't even been called yet etc.
The differences are:
At work I use VS2010 Professional, at home I have VS2010 Ultimate
At work, I use Win XP, at home I use Win 7 Ultimate
At work, its a dual core Athlon, at home a quad core Phenom II
Your symbols file might not match your source. Try deleteing your /bin folder and rebuilding the solution.
Make sure that the project configuration is set on Debug (not on Release!):
If you use other Projects too, make sure to go to Build => Batch Build and check if you build those other projects that you run as well
I'm not sure which one will work for you but you should either tick the Build option or by Modifying Solution Config from Release to build,also you might need to delete your Bin Folder and Build from scratch.Then eiter click on build or do it from Solution Explorer. As shown you can Build other parts of the project and Debugger works rationally again.

Resources