are visual studio macros available in the Command Tool window? - visual-studio

Macros for Build Commands and Properties like $(SolutionDir) and $(ProjectDir) are available as Arguments for External Tools.
Are the same macros available to the Shell Command of the Command Tool Window?
Right now I can resort to using an environment variable, and if I forget to set it before Visual Studio starts, I can remotely inject it. Dynamically Add/Edit Environment Variables of Remote Process
Tools.Shell /c tfpt.exe review %SOLUTIONDIR%
Is there a syntax for the Command Tool Window that will allow me to access the Build Macros?!
Did this syntax somehow escape the design considerations of the Visual Studio team?
Tools.Shell /c tfpt.exe review $(SolutionDir)
Please send any syntax that is known to work, including version of Visual Studio.
If there's already a ticket open on Microsoft Connect for this, I'd accept that as an answer too.
Please no answers that suggest the many optional plugins for Visual Studio that host Powershell, Python or others.

We took a look at the code and it doesn't seem that those macros are available today. I'll file a feature request.

Related

How to write and debug a PowerShell module using VIsual Studio Powershell Tools?

I'd like to take advantage of Visual Studio's debugging capabilities when writing PowerShell scripts, especially PowerShell modules. Thus, I have installed the PowerShell tools for Visual Studio. I created a new PowerShell module project - but I can't figure out how to properly run and debug?
When running such a project I'd expect that the module is loaded and all functions are available in the debug window - and that any code execution would stop at break points.
However, I can't manage to run a module that way. In Solution Properties => Advanced => Entry point I can only select ps1 files. I've RTFM at https://docs.poshtools.com/ but didn't find anything about modules. Just to avoid any confusion, I am not developing anything with C# or VB in this project, just pure PS. I have been developing PS before using Visual Studio Code, but as I am more comfortable with Visual Studio 2019 I might be able to use it for PS development as well.
Any suggestions?

How to configure Visual Studio Code extensions from command line

Installing Visual Studio Code extensions from the command line is very simple is very simple. But lots of extensions require additional configuration to work.
Example: https://github.com/shanalikhan/code-settings-sync#upload-your-settings-for-the-first-time
We have to open the command palette, type a specific command, the paste a Gist ID and hit Enter. Only then the extension can work.
Another example: https://github.com/wakatime/vscode-wakatime#installation
Here we have to restart/reload VSCode and then enter an API key before the installation is actually finished.
How can Visual Studio Code extensions be configured from the command line?
Got a reply on one of the extension's Github that this is not possible right now:
Currently its Limitation from Code, editor doesnt allow extension to perform actions from CLI
https://github.com/shanalikhan/code-settings-sync/issues/465#issuecomment-349903682
The related issue for Visual Studio Code was closed :(

"Build" item in Windows Explorer's context menu of a VS solution file?

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?
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
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.
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
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.
There is a collection of registry entries at http://www.nerdpad.com/windows/msbuild-context-menu-build-net-projectsolution-from-explorer that does this.

How to change "devenv" command location?

I have two versions of Visual Studio 2005/208 installed in my system (windows7), when I am opening Visual Studio with "devenv" command from "Run" window then its opening Visual Studio 2005 but I want when I open it using "devenv" command so Visual Studio 2008 should open by default.
How can I do this in windows.
Thanks
Note: I am not sure this question is for Stackoverflow or for Superuser so just asked it here, if this has any problem then (any moderator) please move it to superuser.
You can follow these steps to open VS2008 from the command prompt using "devenv":
Open the Registry Editor by typing regedit on Run
Locate and open the following key:
My Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\devenv.exe
Currently for VS 2005, devenv.exe is mapped to
C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv.exe
If you want open VS 2008 from the command prompt, you must change the map to
C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe
Just change to 8 to 9.0 to switch from VS 2005 to VS 2008, or VS 2008 to VS 2005.
The problem is that both executables are called "devenv.exe".
What will be happening is that while both the 2005 folder and 2008 folder are on your Windows search path, the 2005 folder occurs first. This means that the 2005 version is found first and gets executed.
Possible solutions:
Rename the 2005 copy to be "devenv2005.exe" (for example). However, you will need to update any shortcuts that point to it to use the new name.
Edit your PATH environment variable to swap the order of the 2005 and 2008 directories.
The second is the least work - depending on how confident you are about editing environment variables.
This is what i have:
REM devenv8.bat
#echo off
"%VS80COMNTOOLS%..\IDE\devenv.exe"
REM devenv9.bat
#echo off
"%VS90COMNTOOLS%..\IDE\devenv.com"
It flashes command prompt momentarily, but I haven't worked out how to get rid of that. Will be interested to know how to have it not do that.
Make two batch files (devenv-2005.bat and devenv-2008.bat) and use them instead of devenv. Make sure to set up the environment appropriately for each one and then launch devenv.exe using the START command with a full path name from within the batch. There are utility batch files shipped with Visual Studio that will set up the environment (e.g., INCLUDE, LIB, PATH, etc.) for you. In VS2005, it was named vsvars32.bat. I would imagine that it is named similarly in VS2008.
The other option is to find the environment script (vsvars32.bat) for VS2008 and modify your user environment to match. I would remove references to VS2005 from the environment altogether just to be safe.
My suggestion is to run Launchy, but I also +1ed the batch file approach. I should add, once with that approach I hotkey launchy, win-space for me, and type either '5' or '8' for vs05 or vs08.

what is Visual Studio 2008 Shell (integrated mode)?

I am new to Visual Studio 2008 Shell (integrated mode), I just want to know what is its function? (I did not find much clearly from the web.)
From http://msdn.microsoft.com/en-us/vstudio/bb510103.aspx
looks like it is some interface/framework to allow tools to integrate with VSTS IDE. My question is whether any Microsoft VSTS tools (like databse designer and other tools in VSTS) dependent on VSTS Shell? I am asking this question because it is conflicting with SQL Server 2008, and I want to make sure that if I uninstaill VSTS Shell, it does not impact anything.
thanks in advance,
George
SQL Server 2008 Management Studio using the VS 2008 Shell. (That's why it looks and feels just like Visual Studio).
Visual Studio Shell is an extensibility mechanism provided to use Visual Studio core platform to provide your own tools. It has two modes. In "Isolated Mode," it'll always set up a separate instance of Visual Studio that hosts your tool. In "Integrated Mode," it'll only install a new VS instance if there's no one already available. If one is already there, it'll integrate with it. I don't think removing it causes any problems for a VS installation. It seems to be smart enough to handle it (it might break a third party tool, however).
The shell version means that applications can merge into the shell and be used independently. Isolated mode means that this version only performs one task and is a complete separate application..
See: VS2k8 Shell
A clearly defined difference is here

Resources