How to make F12 work in MSDEV for non MSDEV project - visual-studio-2010

I am working on a legacy (20 years plus) code base and doing the development in MSDEV 2010. The code is not built in MSDEV, it is done via a batch file using nmake.
I have created an empty windows project in MSDEV and pointed it at the relevant binaries. This works, I can either attach to the exe when it is running or run it in debug from the start - breakpoints, stepping etc all work.
However, I cannot use F12 to lookup the definition of things. When I press it I just get told it cannot find the definition. I have tried adding the files in but that does not seem to help.
Anyone know how I can set this up?

It was far easier than I thought. There is a separate option in 2010 to create a project from existing code.
I simply created the project and added the code from the root of my source tree. Intellisense now works (as does Phat Studio).
I am now trying to figure out how to set the build system up within MSDEV!

Related

VS2017 code changes not affecting .exe file

So I have a problem facing VS code changes.
Whatever changes I have applied to my solution and built, it is working fine and I can see those changes being applied when I debug. But the same changes aren't applying to the .exe file.
I have tried release build as well, Same with that. It Debugs the release build fine but doesn't apply those changes to the .exe file.
It Debugs the release build fine but doesn't apply those changes to
.exe file.
When you debug the project, VS debug engine will try to fetch the output project.exe and project.pdb for debugging. So if the debugging works well(those changes being applied), the output project.exe should also work without any issues(changes applied).
See this(for C++, similar situation with C#, VB):
This error message comes when VS debug engine can't find the output .exe, that's why I say if the changes are applied during debugging, it actually indicates the changes have been applied to your .exe file.
Let me name the project which outputs the .exe ProjectA, other projects in your solution are B,C,D. Here are two directions you can check:
If the code changes you mean is in Project A:
Right click project A in Solution Explorer=>Properties, check the value of your Output Directory(C++) or Output path in build tab(C#), it represents where the output .exe will actually exist, and VS debug engine will fetch the .exe in this path.
So make sure you tested the .exe in this path instead of old versions from other locations.
If the code changes you mean is in B,C,D, and A depends on B,C,D:
In most of the time VS will help copy the assemblies from B,C,D into A's bin folder, but I'm not sure if something's wrong with your environment which breaks this. You should make sure all the assemblies in your bin folder are updated.
I think this issue comes from your project instead of IDE(create a new simple project to check if the issue occurs in it). And in which way did you check if the changes are applied? Make sure you use the same way no matter checking during debugging or checking the .exe.
Updated:
According to Sandesh, this issue could be resolved by a clean(clean
old versions completely) rebuild.
Right click your project and click property, in General page, set "Enable Managed Incremental Build" as "Yes". It will replace the old exe file after every builds.

Building related projects on Visual Studio

I am a Visual Studio noob. My background is more Unix-related and mostly used to building things via scons or make. I don't even have much Eclipse experience.
Anyway, I am frustrated how it seems very difficult to move files between projects in VS. (I am running Visual Studio 2013). For example, suppose I have a ProjectXRel (release) and I want a ProjectXDev (development). I want them both to be runnable, and the dev version might have just a few editing changes that differ it from the rel version.
The intuitive thought is to just copy the files from ProjectXRel to create ProjectXDev, but VS seems to fight me on that (it wants to rename all the namespaces to the title of the project).
Also, some of the files, like .cs files derived from .dbml via OR designer, seem uncopyable, and rely on one replicating the process of using the utility to having valid files. I'm used to a project being defined by its files, but that's not really the case in VS. Instead it seems defined by process steps used to create and organize the files.
Also, do serious developers just use command line calls and powershell? That's seems harder, but at least you know what the %#$$# is going on.....
So, the basic question is, how does one replicate an existing project to produce a similar one for development purposes? (I know source control such as git could help with that, but that's not an option for this situation.)
Thanks!
You should be using the same project for both Development and Release.
The things that are different between Development and Release should be stored in a config file (web.config or app.config, depending on what type of project).
You should then be using Configuration Transformations to transform that .config file into Development or Release.
In Visual Studio, right click on the project and click Add New Item, select "Application Configuration File".
In this file you can put connection strings or key/value pair settings in the AppSettings element (MSDN Link).
Once you have your basic settings defined, you can then right click on the config file and click Add Transformation. This will add transformations for each of the Project Configurations you have. (by default Debug and Release).
It will look like this:
Now you can build deployment packages.
Or install Slowchetah and then when you press F5 to debug it will run the selected project configuration with the configuration transformation applied.

PLATFORM and PLATFORMNAME macros in VS2008 and VS2010

I have got an old project, C++, 64 bits compiled on VS2008. The project is built using some Python scripts (SCONS). I have got to compile it in VS2010.
All is working pretty fine except one small detail: in VS2008 all output goes to Debug\Win64 or Release\Win64, where scripts are looking for it, while in VS2010 it goes to Debug\x64 or Release\x64.
I know that there are PLATFORM/PLATFORMNAME macros being used by VS. Anything I did trying to change these values is mighty ignored by VS, or, if I am changing it manually in vcxproj files, VS refuses to compile at all.
For some company-related reasons scripts could not be changed. So for now I just added to a batch file that runs the script some xcopy commands to copy all the files from\x64 to \win64 before the script starts. It's kind of working, but I would like to know about a more elegant solution.
Thanks,
fLot
Another solution that might work is to create a file system junction so that \Win64 and \x64 becomes two different names to the same physical folder. You have to create a junction for each configuration instead of copying the files but once created it should stick between builds and ensure the two folders have the same content. See Wikipedia: http://en.wikipedia.org/wiki/NTFS_junction_point.

Debugging across projects in VS2008?

We have a DLL which provides the data layer for several of our projects. Typically when debugging or adding a new feature to this library, I could run one of the projects and Step Into the function call and continue debugging code in the DLL project. For some reason, that is no longer working since we switched to Visual Studio 2008... It just treats the code from the other project as a DLL it has no visibility into, and reports an exception from whatever line it crashes on.
I can work around that by just testing in the DLL's project itself, but I'd really like to be able to step in and see how things are working with the "real" code like I used to be able to do.
Any thoughts on what might have happened?
Is the pdb file for the dll in the same directory as the dll? This should all work -- I do just this on a regular basis. Look in the Modules window which will show you whether it's managed to load symbols for the dll. If it hasn't then you won't be able to step into functions in that dll.
It sounds like you have "Just My Code" enabled and VS is considering the other projects to not be your code. Try the following
Tools -> Options -> Debugger
Uncheck "Just my Code"
Try again
I've gotten around this issue by opening a class that will be called in the project you need, placing a breakpoint, keep the file open, and run the debugger. The debugger will hit the breakpoint and the relative path that VS uses will be updated so that future classes will be opened automagically.

VS2008 files and "start debugging"

This may sound like a newbie question - and it is. I'm relatively new to vs, we started using it a few months ago, and I still haven't "mentally" made the change from the command line. So, if you could help me with 2 things:
I create a new project (not a solution). He puts the files in some directory. After putting my code inside it, I click on the little green triangle (Debug, it says), and he compiles it, builds it and runs it. It works ok. Now, sometimes, I have to change only a tiny bit of code and I don't feel like getting the whole VS up just for that. How can I do that Debug thing from the command line, with the assumption I didn't change anything else.
Where do I tell him not to create a "Debug" subdirectory, not to create a HTML Build log, an object file ... and so on, generally, where can I find the settings which will help me to get as little files ... apart from my original source, and the .exe resultant one ?
I have to change only a tiny bit of code and I don't feel like getting the whole VS up just for that. How can I do that Debug thing from the command line, with the assumption I didn't change anything else.
I think what you want here is not debugging but a rebuild of your project.
Where do I tell him not to create a "Debug" subdirectory, not to create a HTML Build log, an object file ... and so on, generally, where can I find the settings which will help me to get as little files ... apart from my original source, and the .exe resultant one ?
The answer to both these questions is to use the command line! You can make VS emit a make file from the loaded project. Use NMAKE to build this make file after you have made your desired modifications. The ".obj" files are created as an intermediate step between compilation and linking phase this is how the C++ compilation model works. Why do insist on not generating them?
You can't really start debugging without starting up Visual Studio, since Visual Studio is the debugger. You can tell VS to rebuild a solution from the command line without firing up the UI if you want to just build it: See MSDN for details.
You can control the creation of the DEBUG and RELEASE directories via the 'intermediate files' option in the project settings. Though you need to create the obj file somewhere in order for the compile to work.

Resources