Visual Studio Development > Visual Studio Integrate - vspackage

I created a basic VSPackage and it is displayed in Tool Menu Option of experimental instance of VS.
Question 1: Once experimental instance of VS opened custom VSPackage should be disabled if user opens any solution file then only it should enable. example : File (Menu)--- Close Solution (SubMenu)
Question 2: After open any solution file, then custom Package inside Tool Menu is clicked i want to show that particular solution file path in alert.
Any tips on these questions are very helpful.
Thanks in advance,
SABARINATHAN.T

To enable/disable based on the opening of a solution listen to the OnAfterOpenSolution event of the IVsSolutionEvents3 interface. You should be aware that this event triggers immediately after the solution opens and doesn't wait until it's completely loaded.
Example to get the solution path:
DTE dte = (DTE) GetService(typeof(DTE));
string solutionPath = System.IO.Path.GetDirectoryName(dte.Solution.FullName);

Related

Can Android studio go to previous opened file after i Ctrl+F4 to close current?

It's an interface problem using Android Studio.
Like any other multiple tab application, using Ctrl+F4 to close the current window/ file gets you back to the previous one.
For example, if i edit MainActivity.java and switch to activity_main.xml I'm used to the behavior that when I click Ctrl+F4 to close the activity_main.xml it goes back to the previous file which is MainActivity.java but for some reason (even after I changed the keymap to Visual Studio) it goes back to a random file.
Does anyone know how to change this behavior?
Before you answer
I'm not looking for shortcut key to reopen last opened window.
The file is still opened, i'm just looking for the regular behavior that the focus will go to the last file automatically after closing file.
File > Settings > Editor > General > Editor Tabs > When closing active editor > Activate most recently opened tab
UPDATE: Consider the other answer first.
Okay, I've understood what you're trying to achieve. You want IDE to track the context in real-time. I think that is not present currently. I would first ask in the JetBrains IDEA Community Forum and then go ahead and open a Feature-request on the IntelliJ IDEA issue tracker. They actually respond quite fast.
Good Luck!
P.S. Android Studio, in fact, uses IntelliJ IDEA underneath

How do I open two or more projects at the same time in Android Studio?

In Android Studio, I want to open another project, so I click File -> Open, but the original project has been closed.
What should I do to open the two projects at the same time?
To open multiple projects simultaneously in Android Studio,
go to Settings > Appearance & Behavior > System Settings,
in the Project Opening section,
choose Open project in new window.
Umh,I have solved my question.
First,I try to click the File->Find Action and search 'open new project'.Then I find a result and enter the settings window:Project opening.(So sad I have no reputation to post a picture)
Select the first check box.

Visual Studio 2013 Edit and Continue not working

With VS2013 Pro I am not able to use "Edit and Continue" when debugging an MFC program. I created a new MFC project to test.
OS is Windows 7 64-bit and I'm running Visual Studio 2013 12.0.30110.00 Update1.
Under Tools->Options->Debugging->Edit and Continue I have Enable Edit and Continue checked. I have unchecked it and checked it, but whenever I modify the code while debugging I get the following message:
The source file has changed. It no longer matches the version of the file used to build the application being debugged.
Basically I haven't changed any settings except for the tab sizes and I've set the keyboard mapping scheme to VC6.
What setting am I missing to enable edit and continue?
Edit and Continue is disabled for native code by default. To enable:
On the Tools menu, click Options.
In the Options dialog box, open the Debugging node, and select the Edit and Continue category.
In the Native-only options group, select Enable native Edit and Continue
Edit:
Steps to test native Edit and Continue is working:
Start VS 2013
Create a new MFC project:
FILE->New Project->MFC Application->OK.
Select Finish on the MFC Application Wizard.
Build and start debugging:
BUILD->Build Solution
DEBUG->Start Debugging
Break into the program:
DEBUG->Break all
Make a code change:
Open OutputWnd.cpp and find COutputWnd::OnSize (Line 80)
Insert this line at the start of the function: cx = cx / 2;
Continue execution:
DEBUG->Continue
Resize the application window to see the effect of the code change on the Output pane at the bottom. Its width should be half the required size.
Edit and continue is also a Setting for each project.
It must be set in the compiler options under C++ -> General -> Debug Information Format: "Program Database for Edit And Continue (/ZI)"
Also the linker settings must be changed. The linker has to use incremental linking. Linker -> General -> Enable Incremental Linking = Yes or (for VC 2012 users) C++ -> All Options -> Enable Function-Level Linking = Yes (/Gy)
For more information read the MSDN.
The last hint helped, but we had to
set "Image Has Safe exception handlers" = NO(/SAFESEH:NO)
in all projects of our solution!
I did all steps described above, but nothing helps (thanks all for it).
My solution was:
Project -> Properties -> Linker -> Advanced:
set
"Image Has Safe exception handlers" = NO(/SAFESEH:NO)
Apply, Ok, and Rebuild project.
Hope it helps.
For what it's worth I've been pulling my hair out on this one as well. I finally got edit and continue working by changing the following setting:
Project > Properties > Linker > All Options > "image has safe exception handlers".
It was set to No (/SAFESEH:NO). I went in and deleted it. I didn't set it to YES, or NO. I simply kept it blank. I would love to know what it means to be blank. But edit and continue is now working for me. Maybe it will help for you.
A project with a "Release Configuration" will disable Edit and Continue.
To change this
Open "Configuration Manager"
Change Configuration for the project from Release to Debug
Rebuild and debug project
Edit and Continue will also not work if your project's Platform Toolset is set to Visual Studio 2012 (v110), instead of the usual Visual Studio 2013 (v120).
This setting is in Project > Configuration Properties > General > Platform Toolset.
The solution of this problem is on the Microsoft Documentation...
If IntelliTrace is enabled and you collect both IntelliTrace events and call information, Edit and Continue is disabled.
On Visual studios' menu go on Tools>>options - Select "IntelliTrace" tab and let IntelliTrace events only checked.. Save, restart the visual studio and.......
Your Edit and Continue will work again!

How to choose which file to debug in Visual Studio 2012 prof

Kinda stupid question, but I've only been using this IDE for two days now. I havent found anything in google yet and I figured that once in a while you're entitled to a stupid question:
I have a project (or solution as Microsoft chose to call it) with two .cs-files. When I click on debug, it's alwys the same file that opens. How can I get VS to open the other .cs-file?
It sounds like you have multiple static Main methods in your project. If that's the case then you have to set the startup object to the object that you want to run.
Right-click on the project in the Solution Explorer and select
Properties (or select Project >> Projectname Properties from the
toolbar).
On the Application form, select the appropriate value
for Startup Object.

Visual Studio 2012 not recognizing all pending changes?

I'm working in TFS with my team for project and the problem occurs when I'm trying to make new modeling project for my classes, it doesn't show up in pending changes.
So here is how I go:
First I enter my folder where I keep my classes. I've tried from there many combinations: I've tried first right-clicking on my folder and putting "check-out for edit" and then continued to * (see later); next I've tried clicking on .csproj of my classes so I activate my project when I'll be adding modeling project and then moved to *; last I tried to activate whole solution of our whole projects which is connecting them and then to moved to *.
None of it worked. (I was always having last version)
here is what I did next for all the possibilities:
I went to Architecture -> New diagram (named diagram and left create new project) -> Create (then windows shows up for creating new project in which folder and I always select my folder where I keep my classes).
After when that was done, I went to check to "pending changes" in Team Explorer, because there should be some available since I created already Modeling project. But there was none. Since I couldn't do it like that, the last solution how I made it was by right-clicking to Source-control Explorer on my project and going to Add items to folder and selected my project which was created locally where I wanted it to be created.
But, this last solution was giving me errors while trying to open my modeling project after. I know I should activate first modeling project, so I clicked to .modelproj and while clicking to it, it was giving me this "notice" or rather "warning":
The solution you have opened is under source control but not currently configured for integrated source control in Visual Studio. Would you like to bind this solution to source control now?
--
What am I doing wrong? Why solutions are not integrated by default while creating my project (my friends are doing it automatically, they don't need to right-click in Source Control Explorer to add item to be able to see pending changes)?
I hope I made myself understandable.
It looks like your solution binding is broken. Either click yes on the question to bind your solution to source control, this is information that must be stored in the solution file and while Visual Studio does see that the folder is mapped to source control, it also sees that your solution isn't (did you check the add solution to source control checkbox when you created it?)
Optionally try opening file -> Source Control -> (optionally) Advanced -> Manage Source Control. You can select project in your solution individually and then click the bind button on the toolbar to bind them to sourcecontrol manually.
I had a similar issue and, in my case, the solution was to right click on my project and choose Source Control->Go online. Apparently I must have somehow been switched to the offline mode.
I have successfully checked in files from source control explorer instead of solution explorer in this case. Then after that it has worked again
VIEW > Other Windows > Source Control Explorer
Other way to do it:
File--> Source Control --> Advance --> Change Source Control.
In the window displayed select all the projects you want to bind to the TFS
I had the same issue and solve it by clicking:
File -> Source Control -> Advanced -> Refresh Status
In VS2013+, you can check if your solution is online. In my case, due to VSO service outage, my solutions went offline. I had to open the solution, File > Source Control > Go Online.

Resources