Using relative path for “Start external program” in VS.NET 2010

I know this is a little late to the party, but here’s how we do it. The key to this is to set the ‘OutputPath’ explicitly to the Build directory. This re-bases it to working directory and not the VS install directory.

  1. Update output path for the project to be:
    <OutputPath>$(MSBuildProjectDirectory)\bin\</OutputPath>

  2. Update StartProgram for the project to be:
    <StartProgram>$(OutputPath)Relative.exe</StartProgram>

Here is a sample configuration PropertyGroup:

<PropertyGroup Condition="'$(Configuration)|$(Platform)' == '0-Local|AnyCPU'">
   <!-- default values you should already have in your csproj -->
   <PlatformTarget>AnyCPU</PlatformTarget>
   <DebugSymbols>true</DebugSymbols>
   <DebugType>full</DebugType>
   <DefineConstants>DEBUG;TRACE</DefineConstants>
   <ErrorReport>prompt</ErrorReport>

   <!-- actual output path and start action definition -->
   <OutputPath>$(MSBuildProjectDirectory)\bin\</OutputPath>
   <StartAction>Program</StartAction>
   <StartProgram>$(OutputPath)NServiceBus.Host.exe</StartProgram>
   <StartArguments>NServiceBus.Integration</StartArguments>
</PropertyGroup>

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)