In a C# project I try to use relative paths for "Start external program" and for "Working directory".
I tried relative paths starting with ../
and relative paths with $(SolutionDir)
/ $(ProjectDir)
With all tries I get an error popup. (The external program cannot be found / the working directory you entered does not exist) - see screenshots.
Is it possible to use relative paths and how? I also searched on msdn but there is almost no info about the csproj.user file.
We need this as we don't like to force a folder structure for all developers.
This is stored in the csproj.user file (myproject.csproj.user) like this:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectView>ProjectFiles</ProjectView>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<StartAction>Program</StartAction>
<StartWorkingDirectory>%24%28SolutionDir%29\..\..\..\..\mydir</StartWorkingDirectory>
<StartProgram>%24%28SolutionDir%29\..\..\dir\myapplication.exe</StartProgram>
</PropertyGroup>
</Project>
I tested all the ideas. Unfortunately none of the answers did work or had enough detail, so I added my own.
Relative paths does work, but StartProgram and StartWorkingDirectory has different initial directories!
StartProgram starts in the directory where the solution file (.sln) is located
So I have now working for me:
..\mydir\myapplication.exe
..\..\..\..\..\mydir
(same directory as the myapplication.exe
)