Project Configuration Variables

I seem to remember being able to access certain configuration variables in VS within the Configuration Screen. Things like $OutputDir$ and so forth. Are these available in Visual Studio for Mac?

Posts

  • MichaelBrown.2994MichaelBrown.2994 USMember ✭✭

    Here is what I'm looking for

    https://stackoverflow.com/questions/11074717/meaning-of-outdir Is there an equivalent in VS for Mac?

  • mattwardmattward GBMember Xamurai

    You should be able to use the same MSBuild variables.

  • MichaelBrown.2994MichaelBrown.2994 USMember ✭✭

    Yeah....I tried to do that it didn't work, that's why I was asking here.

  • mattwardmattward GBMember Xamurai

    If you create a new C# console project then the Build - Output uses bin/$(Configuration) and that works. What variable are you using and where are you trying to use it?

  • MichaelBrown.2994MichaelBrown.2994 USMember ✭✭

    I'm trying to use $(OutputDir) as an environment variable for the startup

  • mattwardmattward GBMember Xamurai

    $(OutDir) works for me as a run configuration. The only problem I can see is that the $( ) parts are encoded in the generated .user file which breaks it.

    I created a new C# console project, and then went into project options, Run Configurations - Default, changed the Start action to Start external program, then added $(OutDir)\MyApp.exe. That did not work so I edit the generated .csproj.user file to be:

    <?xml version="1.0" encoding="utf-8"?>
    <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
      <PropertyGroup Condition=" '$(RunConfiguration)' == 'Default' ">
        <StartAction>Program</StartAction>
        <StartProgram>$(OutDir)\MyApp.exe</StartProgram>
      </PropertyGroup>
    </Project>
    

    Reloaded the solution, and then running the project runs that .exe directly using the StartProgram information.

Sign In or Register to comment.