0

I am using visual studio 2015 IDE for a project. Now we need to ensure that we can also build command line using the same .sln file.

I am able to call the sln file but when vcxproj file gets invoked it is taking wrong path in the environment variable. Can i print the environment variable specified in the command line in vcxproj file. ?

  • Please clarify your question. Which environment variable, what is the expected value, what is the value you get? You do start the build from a *Developper Command Prompt for VS2015* (in the Start Menu) right? To print the variable: just use `` in a target which gets invoked in the build. – stijn Apr 18 '16 at 07:53
  • @stijn absolutly Right add hear your code and implement way how you are doing. – Amitsharma Apr 18 '16 at 08:00
  • Stackoverflow is not a 'give me the code' service; please read my comment carefully: it contains *4* questions and you answer none of them, you should update your question accordingly. Anyway, this seems a duplicate: http://stackoverflow.com/questions/4771913/how-to-output-a-variable-value-to-the-log-from-msbuild – stijn Apr 18 '16 at 11:50

1 Answers1

0

You could add markup like this to your .csproj file right after your import of the Microsoft.CSharp.targets file. It would look like:

  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <Target Name="BeforeBuild">
    <Message Text="MyEnvVar=$(MyEnvVar)" Importance="high" />
  </Target>
Bern
  • 31
  • 5