Visual Studio 2022 Solution Upgraded from Visual Studio 2013 Fails to Set Telemetry Environment Variables

585 Views Asked by At

I recently upgraded a Visual Studio 2013 Solution with C++ Libraries in it to Visual Studio 2022. Everything went great except there were three major environment variables not set.

The error:

Error   MSB4044 The "SetEnv" task was not given a value for the required parameter "Value". testproject C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.Cpp.DesignTime.targets  550

Because environment variables VSTEL_SolutionSessionID, VSTEL_CurrentSolutionBuildID, and ProjectGuid were not set. In a fresh solution they are, but I cannot find them defined in either the solution or the project of a new console test solution. They appear to be telemetry variables and I do not know why they are missing. Defining these variables in the system environment variables all as -1 allows the upgraded project to complete, but the root cause is unknown.

What mechanism should these variables be set with normally and what can I look for to set them?

Occurred in in the targets file:

 <Target Name="SetTelemetryEnvironmentVariables"
          Condition="'$(DesignTimeBuild)' != 'true'">

    <SetEnv Name   ="VSTEL_SolutionSessionID"
            Value  ="$(VSTEL_SolutionSessionID)"
            Prefix ="false">
    </SetEnv>
    <SetEnv Name   ="VSTEL_CurrentSolutionBuildID"
            Value  ="$(VSTEL_CurrentSolutionBuildID)"
            Prefix ="false">
    </SetEnv>
    <SetEnv Name   ="VSTEL_ProjectID"
            Value  ="$(ProjectGuid)"
            Prefix ="false">
      <Output TaskParameter="OutputEnvironmentVariable" PropertyName="VSTEL_ProjectID"/>
    </SetEnv>
  </Target>
0

There are 0 best solutions below