9

I wonder why this is not integrated by default. I'd like to have an item in Windows Explorer's file context menu of a VS solution file to build it.

Is there a tool for this? Or do I have to create this myself?

Xearinox
  • 3,224
  • 2
  • 24
  • 38
mafu
  • 31,798
  • 42
  • 154
  • 247
  • 1
    Neat idea, but why would you ever need it? – Paolo May 14 '10 at 10:30
  • 1
    Because it is faster than opening the solution and hitting F6. Especially if you have a couple of solutions that need to be rebuilt. – mafu May 14 '10 at 12:16

5 Answers5

17

MSBuild Shell Extension have been there for years,

http://msbuildshellex.codeplex.com/

But you might also try out my new project,

http://msbuildlaunchpad.codeplex.com/releases/view/45368

It is quite easy to use. MSBuild Launch Pad http://i3.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=msbuildlaunchpad&DownloadId=122261

Lex Li
  • 60,503
  • 9
  • 116
  • 147
2

It's going to be fairly high maintenance, but not impossible. Open Regedit.exe and locate the HKCR\VisualStudio.csproj.9.0 key. Add the Build verb, make it look similar to this:

[HKEY_CLASSES_ROOT\VisualStudio.csproj.9.0\shell\Build]

[HKEY_CLASSES_ROOT\VisualStudio.csproj.9.0\shell\Build\Command] @="cmd.exe /k c:\temp\build.bat %1"

The cmd.exe /k command opens a console window so that you can read any error message from the build. The c:\temp\build.bat file ought to look similar to this:

call "c:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86
msbuild %1

You probably also want to add the Build key to HKCR\VisualStudio.Launcher.sln so you can build solutions as well. That however is a bit of a version maintenance headache.

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
  • A possible solution for the version maintenance headache is to write your own launcher who automatically parses the csproj/sln/... files, and then locate the correct msbuild to use. This is what I want to achieve in MSBuild Launch Pad. – Lex Li May 15 '10 at 22:55
  • For any poor sap trying to do this in Visual Studio 2019 in Windows 10 watch out for the override in `HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.sln` (described here https://superuser.com/questions/1424724/file-extension-shell-verbs-dont-show-up-in-windows-10-context-menus) this will override the ability to add an additional option to the context menu UNTIL you delete it. – aolszowka Jun 13 '20 at 01:38
2

Here is a project to do it for VS 2003 & 2005. It could easily be altered for 20080 and 2010 too i imagine.

http://www.codeproject.com/KB/winsdk/VS_BuildHere.aspx

Mike Ohlsen
  • 1,900
  • 12
  • 21
1

You might be able to cook up something using MSBuild.exe along the lines of

<path_to_msbuild_executable>\MSBuild.exe /p:Configuration="<config>" %1

However, you would have to specify a configuration and then it will be hard to see all the output from the build. I'm not sure this would make all that much sense.

sbi
  • 219,715
  • 46
  • 258
  • 445
  • Additionally, I'd have to put this in the right place in the registry. I barely remember that this is easy, but it's a hassle nonetheless. – mafu May 14 '10 at 12:17
0

There is a collection of registry entries at http://www.nerdpad.com/windows/msbuild-context-menu-build-net-projectsolution-from-explorer that does this.

Kevin Whitefoot
  • 414
  • 3
  • 15