Search code examples
visual-studiovisual-studio-2015visual-studio-2017visual-studio-extensions

DevEnvDir in VS2017 points to VS2015


In my extension project file I'v set Start Action to start Visual Studio by setting StartPrograms in my project file (.vbproj if that matters)

<StartPrograms>$(DevEnvDir)devenv.exe</StartPrograms>

The problem is that when the project is open in VS2017 it opens VS2015 and in project properties I see:

Project properties

Is there something wrong with my project? Or do I undersant DevEnvDir wrong way?


Solution

  • DevEnvDir in VS2017 points to VS2015

    That because you set the Start external program is Visual Studio 2015. And this info stored in the .csproj.user file. If open that .csproj.user file in the same folder as project file, you will find following:

    <?xml version="1.0" encoding="utf-8"?>
    <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
      <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
        <StartAction>Program</StartAction>
        <StartProgram>C:\Program Files %28x86%29\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe</StartProgram>
      </PropertyGroup>
    </Project>
    

    So, even if you specify the StartPrograms in the project file, but specify Start external program in the project property will overwrite it.

    To resolve this issue, you should specify Start external program as Visual Studio 2017:

    C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\devenv.exe
    

    Hope this helps.