How to get an event on file save - visual-studio-2005

I am planning to integrate NArrange in my visual studio solution,i want to run this exe whenever a file is saved,Is there a way to receive event when file gets saved?
I have heard about macro but do not have much information on that.

I don't know that you can get at a post save event for a file, but you might be able to add a post build event to the project(s) you care about. Just right click the project, in the solution, click properties, and then post build event. Whatever you add in here will run after a successful build of your project. You can get more information about pre and post build events here

Related

Visual Studio: How to detect any changes on project properties and trigger event from extension when user click apply

I'm trying to write VS extension for VC++ projects, I want to detect any changes on project properties (Additional include directories, additional using directories etc.) when user change and click apply on project properties page.
I don't want to trigger event until user clicks apply. If user click, I want to fire an event from My extension. Thanks for your help.
I tried to capture Command Events from EnvDTE but I did not find Command code for Apply button. In the case of clicking apply, VsStd97CmdId will be 684 or 1990. Those are not specific for apply command.
Other thing that I tried was, detecting changes on project file, but Changes are not saved vcxproj file until save or save-all

VSpackage how to call operations on the project

Is there a way In a VSpackage to issue a clean on the project from code, to issue a rebuild or a build. So basically is there a way in code to call the commands that appears in the context menu when you left click on a project? (though my current context may not be in solution explorer I may be on the editor window, so calling ExecuteCommand wont work for commands that are only available when I am in the solution explorer)
The SolutionBuild-interface offers various methods that allow performing actions on the solution, e.g. building the solution or a project and cleaning the solution.
You start at the DTE-object and access the SolutionBuild like this:
// Builds the solution and waits for the build to finish
DTE.Solution.SolutionBuild.Build(true);
// Show result of build
MessageBox.Show(string.Format("{0} projects failed to build.",
DTE.Solution.SolutionBuild.LastBuildInfo));

Including additional files when publishing an app with Visual Studio 2012

I have a console application that I've been developing and I'm just about ready to publish it for consumption.
However, there's a file that the app needs to reference (a couple files actually) and I'd like to try to include these either during install logic or via an outside process. Here's the situation:
The application fires off a load test based on some criteria the user chooses. The load test is defined by a .loadtest file which is created outside of this project.
So what I would like for the installer to do is contain the .loadtest files and just shove them in a default directory that the project can reference.
I can't figure out how to add this specific file as a pre-requisite or anything though, in the publish wizard. Any ideas?
When you add a file to the solution, it does not automatically get attached as part of the build in some cases. If you right click the file in your solution explorer and select "Properties", change the build action to "Content". This will ensure that VS includes the file as part of the build/publish and places it in the output directory of the build process.

Visual Studio Team Services is there an icon to notify when files have been updated

I am using VS2012 with TFS on a server workspace.
When someone checks something out a person icon is shown next to the file so you know it is currently locked by someone else, however when they check it back in the icon changes back to a lock icon without any indication that the files has been updated.
Is there a setting i'm missing that will show that you don't have the latest file maybe an icon next to the file in the solution explorer?
The only way i see how to do it is to view history on each file or go to the source control explorer and run a compare on every files, both of these options are not very efficient as I would not know when to perform this so i would have to do it on every check out.
Thanks in advance.
No, you did not miss any particular detail. After the checkin, the icon returns to a lock, and there are no notifications by default.
I believe that there is nothing that can be done about the padlock icon, but you can set up alerts (e-mail) to be triggered when check-ins are made.
Take a look here and here (alerts for specific folders) to understand how to configure e-mail alerts using TFS Event Service.
You can also bind notifications to workitems.
If your TFS is configured to use gated-checking to perform a build on a "build server" before each check-in, you can subscribe to the Team Foundation Build Notification to receive notifications of new builds that were queued/processed on the server.
Hope it helps.

How to automatically regenerate DB partial project files?

I am using advanced version of Visual Studio 2010 and using database projects. There's a feature of exporting database schema as partial project (which creates *.files output file), but it is triggered manually by the developer (you need to right-click on the project and select Export as partial project). I would like to automatize this process, meaning that the output file is created each time I modify the database, I build it OR I close the solution.
I tried creating a macro, which executes a DTE command Project.VSDBExportAsPartialProject, but sometimes it fails with an exception AND it shows a Save as dialog box, which I would like to avoid. Maybe the idea is to add it to the post-build event, but I don't know how to execute DTE commands from there.
To sum up, all I need is to automatically refresh the *.files output file located in fixed path without any user interactions.
Is it possible?

Resources