Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

People in my office often ask me 'how do I run those tests?'. I tell them, browse to the Build folder, open a command prompt, and run msbuild /t:Tests.

That works for me, because msbuild is in my path

> where msbuild.exe
C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe

However it doesn't work for everyone else, because they might not have that folder in their path. Explaining how to change that is tedious.

Is it possible to make the command work for everyone, even if they don't have the folder in their path?

I'm imagining a file msbuild.cmd in the Build folder that fixes the problem. It would run the real msbuild.exe with the same arguments (it's not always /t:Tests). It would first look in the path for msbuild.exe, then in C:\Windows\Microsoft.NET\Framework\v4.0.30319.

share|improve this question
    
Sure...Just tell them the full path of the exe and include that in the command you tell them. Infact forget about the path file if you simply did C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe /t:Tests it does what you want. –  Ramhound May 31 '13 at 15:38
add comment

1 Answer

Went with

@echo off
REM This shim helps anyone who doesn't have msbuild in their path.

for %%X in (msbuild.exe) do (
    msbuild.exe %*
    exit /b
)

echo "You should probably add msbuild to your path."

"C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" %*
exit /b
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.