Blend - watch out - it uses the PLATFORM enviornment variable

    General discussion

  • Everyone,


    I just purchased a brand new HP Quad Processor system, 64 bit, 4GB memory, NVidia 8800, Vista Ultimate, 24" monitor, the works.


    Well, I loaded up a project I've been working on for 3 weeks and Expression Blend displayed weird errors.


    Telling me that my solution file had platform type of HPD.  It's looking for Any CPU, x86 or x64.


    Turns out, HP loaded my system with an environment variable PLATFORM=HPD.


    What's really unusual is that VS 2005 had no problems.  Compiled and ran.


    Maybe someone from Microsoft can comment on why Blend was being sensitive to the environment variable but VS 2005 was not.


    At any rate, hope this helps someone and saves them from...



    Saturday, June 02, 2007 9:38 PM

All replies

  • Hi Karl,


    Thanks for the heads-up.


    You will also notice that the build will fail at the command prompt using MSBuild (which is what Expression Blend and VS use underneath the covers to build the project). In VS, when you build, it sets the build configuration type (Debug, Release, etc.) and the Platform build variable and hence you don't see this issue. Expression Blend (and the command line MSBuild don't). The workaround would be to force MSBuild to use the right value.


    If you post your project file's contents here (the .csproj file), I will try to modify it such that it builds correctly. Alternatively, send to me at unnir at microsoft dot com.




    Sunday, June 10, 2007 12:21 AM
  • Unni,


    Thank you.  That is what I figured out.  I just removed teh enviornment variable and everything works no problem.


    Have a great day!



    Monday, June 11, 2007 1:32 PM
  • Unni;


        Your anwser is not true. My project file clearly show Plaform is AnyCPU as the following piece of project file. A full project file is just a waste of space.

       I had the same error with Visual Studio 2008 Professional trial version and .Net 3.5. The problem is that msbuild overrides the value of PLATFORM from the project file with the HP defined environment variable value of HPD. So the workaround is either unset PLATFORM value from the cmd console before run the msbuild or remove that environment variable from the system.




    --------------------------------------------------------   here the partial project file -------------------


    <?xml version="1.0" encoding="utf-8"?>
    <Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="">
        <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
        <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
      <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
      <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">

    Monday, January 28, 2008 1:27 AM
  • Yes, that is one way to solve this issue.


    Please note that we have fixed this issue in Blend 2 (not sure if the fix is in the December Preview or not - I think it is) such that Blend will be able to build the solution with the environment variable set. However, MSBuild won't be able to build the solution at the command prompt (we now mimic the VS 2008 behavior, which is different from the MSBuild behavior).




    Monday, January 28, 2008 2:46 AM