How to access vs2010's BuildEngine from an AddIn? - visual-studio-2010

Is it possible to access Visual Studios BuildEngine from an AddIn?
I want to start a build target whenever a file with a specifice extension is safed.

Refer to this answer: run a custom msbuild target from VisualStudio
You'll just need to wire into a different event handler, but otherwise the details are the same.

Related

How to change Primary Output Source Path in Visual Studio 2010 Setup Deployment?

How can I change Primary Output Source Path in Visual Studio 2010 Setup Deployment?
Currently the source path is:
C:\VisualC#\Projects\MyApp\Obj\x86\Release\myapp.exe
I want to change the source path to bin\release\
so when I build my setup, it packages bin\release assembly.
You need to specify post build events in your project file.
Follow the steps below:
In Solution Explorer, select the project for which you want to
specify the build event.
On the Project menu, click Properties.
Select the Build Events tab.
In the Post-build event command line box, specify the syntax of the
build event.
In the Run the post-build event box, specify under what conditions
to run the post-build event.
You can use the guide provided by MSDN here:
https://msdn.microsoft.com/en-us/library/ke5z92ks.aspx
And if you'd like to use any common Macros, here is a list provided by MSDN:
https://msdn.microsoft.com/en-us/library/c02as0cs.aspx
I hope it supports your question, please don't hesitate to ask if not.

No build notifications with VS 2015?

We used to set up our dev machines to receive build notifications in the task bar.
However, the process we've followed - as per this description - doesn't apply any more with Visual Studio 2015 as the Build Notification app is no longer part of the package?
Any ideas what happened to it? Replacements? Work-arounds?
Update 4/2016: Nothing appears to have changed with Update 2 - new build definitions still don't show up..
The BuildNotificationApp is still a part of the VS 2015 and can be found here: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\BuildNotificationApp.exe. However, it looks like only XAML build definitions are visible to this tool.
The new vNext features can be accessed via the new REST API. I failed to find the explicit confirmation from the official source, but most likely the app was not made compliant with this new approach.
Basically, you have the mail notifications as the only option. Make sure the mail server settings are configured properly for the application tier, and create the appropriate email alert.

Visual Studio SDK - Handle File Save Event

I would like to run a script after files with certain extensions are saved in visual studio. I am wondering where the event handler for saving a file is located in the Visual Studio SDK API.
Can anyone point me in the right direction in terms of API documentation for visual studio extensions. I have found the Visual Studio SDK Reference but some direction or sample examples would be helpful.
I want to create partial designer files that are usually generated when the project is built (Mono for Android Project), my files will have temporary values, but are only intended to enable intellisense without building the entire project. I can run the process manually right now, but I would like to trigger the script when .xml or .axml files are saved.
It think I need to work with IVsRunningDocTableEvents.OnAfterSave method, but I'm not sure about how I get the handle on the running doc table, or how I filter the files I want to run the event for. This is my first attempt at using the Visual Studio SDK.
The event handler for saving files is:
Dte.Events.DocumentEvents.DocumentSaved
Note you need to keep a reference to Events and DocumentEvents in order for it to actually work. Here is some information on that: http://social.msdn.microsoft.com/Forums/br/vsx/thread/0857a868-e650-42ed-b9cc-2975dc46e994
Here is a link to 30 sample projects that illustrate all kinds of functionality for Visual Studio Add-Ins:
http://code.msdn.microsoft.com/Visual-Studio-2010-SDK-ddfe1372
You can find some getting started informatin here:
http://msdn.microsoft.com/en-us/vstudio/ff677564.aspx

Post-build event syntax Visualstudio 2010

I'm trying to do some automation on my project build. I would like to ask user to input version number and then use it as an variable but i just can't get it work.
Any examples of syntax would be great.
Try to create a batch file which is started after successfully postbuild which user asks for any input.
Also look How to: Specify Build Events (C#) and Visual Studio Post-Build, Pre-Build Macros
Hope that helps

Integrating MSBuild into Visual Studio

I'm a solo developer running Visual Studio 2008 and looking into MSBuild to improve my build process.
Almost all of the tutorials I've found so far have plenty of information about writing a build file. However I'm having a lot of trouble finding out how to integrate MSBuild into Visual Studio. Maybe MSBuild is only used with something like CruiseControl but that's overkill for me as a single developer.
Where should the build file live in a Visual Studio project and how can I run it from within the IDE?
Visual Studio executes MSBuild automatically for projects it supports.
If you right click on a project and unload it, you can then edit it in Visual Studio. Reload (right click on project again), force a (re)build to test your changes. An alternative is to edit the project file in an external editor and Visual Studio will detect saves and offer to reload the project for you.
Sounds like you're on the right track, and if you are considering writing Targets or custom MSBuild Tasks, take the time to separate them from your current project so that you can re-use them. Don't re-invent the wheel though, the two main complementary MSBuild projects are MSBuild Community Tasks and MSBuild Extension Pack.
Update: Judging from your comment on Mitch's answer, you might also want to consider adding a new Configuration element or custom properties to a project. A new MSBuild Configuration (something other than the default Debug/Release) could run unit tests, build documentation, or whatever you want automated. A custom MSBuild property would allow you to use normal Debug/Release Configuration and extend it to automate more of your build process, just depends on what you want. Either approach could also be driven from the command line.
As others have noted, MSBuild is already available when you install Visual Studio.
If you want to integrate into VS2008: Running MSBuild from Visual Studio
MSBuild is the build engine used by Visual Studio to process the files included in a project.The Visual Studio project files themselves (**.csproj* for C#, and .vbproj for VB, for example) are in fact MSBuild scripts that are run every time you build a project.
Your .csproj file is a MSBuild file. So you are actually using it already.
You may of course wish to create a separate build file to have more control, especially within a continuous integration or nightly build say.
If you simply wish to edit your project build file then you can use the IDE to edit some settings such as pre and post build actions or edit the Xml itself by unloading project and right click and editing.
You can use your current .vcproj files to build your project with MSBuild. However, as MSBuild is not directly supported (at least for vc++) vcbuild is used instead (internally).
In VS2010 all project files are MSBuild based...
This is an older article about some simple extension points from the msbuild team
How To: Insert Custom Process at Specific Points During Build
Also, don't forget you can use the MSBuild SideKick for developing and debugging your (local) msbuilds, available for free at http://www.attrice.info/msbuild/
I'd suggest you call msbuild as a post build step. Then you can put your build script somewhere in your solution and call it.
<windowsdir>\Microsoft.NET\Framework\v3.5\MSBuild.exe c:\temp\MyProject\mybuildfile.proj
The easiest way is probably to invoke your custom build script using a post-build step. Right click project, choose "Build Events" and call msbuild with your custom msbuild file from there.
I use the msbuild template to intergrate with visual studio
http://msbuildtemplate.codeplex.com/

Resources