none
Microsoft.Cpp.Win32.user property sheet file shared by both VS2010 and VS2012? RRS feed

  • Question

  • I have both VS2010 and VS2012 installed.  The problem I had initially was that VS2012 projects would not build complaining of a missing Kernel32.lib file.  Subsequent searching through the forums revealed the issue was that the Microsoft.Cpp.Win32.user property sheet file was referencing in Library Directories "$(WindowsSdkDir)lib" which will not work for VS2012.  It should be changed to "$(WindowsSdk_LibraryPath_x86)lib" instead. 

    I changed it and that does make VS2012 build okay but it breaks VS2010.  It appears both VS2010 and VS2012 use the same Microsoft.Cpp.Win32.user file.  Is there some way to have VS2012 use a different Microsoft.Cpp.Win32.user from VS2010 so that both will build projects successfully?  The file is located in C:\Users\<me>\AppData\Local\Microsoft\MSBuild\v4.0.

    If the Microsoft.Cpp.Win32.user property sheet is meant to be shared by all VS versions, then is there some way to have all new VS2012 projects automatically inherit a custom property sheet I create?  For example, I made a custom property sheet called "Common" that is identical to Microsoft.Cpp.Win32.user.props except that "$(WindowsSdkDir)lib" was changed to "$(WindowsSdk_LibraryPath_x86)lib" in the Library Directories row and I added that to my VS2012 project.  It built successfully (while VS2010 projects are unaffected). 

    So my VS2012 project now shows this in property manager:

    Thanks in advance for solutions.

    • Edited by pagosa1999 Monday, July 29, 2013 9:18 PM
    Monday, July 29, 2013 6:16 PM

All replies

  • I'm trying to involve some senior engineers into this issue and it will take some time. Your patience will be greatly appreciated.

    We will let you know if any progress is made. Sorry for any inconvenience.


    Sophia Gou
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    Tuesday, July 30, 2013 4:48 AM
  • Has there been any progress on resolving this?  Every new VS2012 project I create automatically includes the same Microsoft.Cpp.Win32.user file that the VS2010 project uses and therefore it points at all the old libs used by VS2010 instead of the new ones I want to use in VS2012.  Is there any way to control what property sheets VS2012 new projects get so that I can create a new VS2012 property sheet that all new projects would use instead of Microsoft.Cpp.Win32.user?  Currently the only solution is to manually remove Microsoft.Cpp.Win32.user from all new VS2012 projects and then add in my new property sheet to them.  There should be some way to avoid manually having to do that for each new project.
    Wednesday, August 14, 2013 1:33 PM
  • Hi,

    Do you have a repro handy?

    Nibu


    Blog: http://ntcoder.com/bab


    Posts are provided as is without warranties or guaranties.

    Thursday, August 15, 2013 9:13 AM
  • Hi Nibu.  There's no need for a special repro project to duplicate this.  Every single project is like that.  But here are steps to do it:

    Create a new VS2010 project named Sample.  I used a dialog application type but it makes no difference.  Open Property Manager and you'll see it includes Microsoft.Cpp.Win32.user for both Debug and Release.  Right click on Microsoft.Cpp.Win32.user (in either Debug or Release) and pick Properties to edit the property sheet. Pick VC++ Directories and change any of the lines. In the screen shot below, I changed "Include Directories", "Library Directories", and "Source Directories" to point to a bunch of folders on my system which show in "bold" text.

    Now open VS2012 and do the same.  I created a new project named 2012Sample.  Again I used a dialog app type but you can use any app type.  Just like with VS2010, open Property Manager and you'll see that for both Debug and Release that Microsoft.Cpp.Win32.user has been automatically included.  If you right click on it and pick Properties, you'll see that the VC++ Directories are the same as what you changed them to in the VS2010 project - it has all the additional folders that you added.  That's because it's the same property sheet file that's being automatically added to both VS2010 and VS2012 projects.

    Again, the issue is that the exact same property sheet (Microsoft.Cpp.Win32.user) is automatically added to all new VS2010 projects as well as all new VS2012 projects.  For my VS2010 projects, a long time ago I modified Microsoft.Cpp.Win32.user to point to all the various folders I needed for 3rd party lib, include, and source files so that the VS2010 projects would compile successfully. But I need to use other 3rd party lib, include, and source files for VS2012 projects.   As it is, the VS2012 projects will try to build using the old 3rd party libs which are not compatible with VS2012.  Likewise, if I were to change Microsoft.Cpp.Win32.user to point to the new libs instead, then the older VS2010 projects won't compile correctly because they'll try to use the new libs instead.

    Ideally VS2012 should use a different default property sheet than VS2010 uses so that you can modify as needed and not affect VS2010. Or have some way to control what property sheets are automatically included in new projects so you could create a new custom sheet that is automatically added to new projects instead of Microsoft.Cpp.Win32.user. 

    The only solution so far is for me to remove Microsoft.Cpp.Win32.user via Property Manager from all new VS2012 projects, then add a custom property sheet I create that has all the directories to the new lib files that will be required.  That's a pain though. There should be some way to control what property sheets are automatically used for new projects but there doesn't seem to be.

    This wasn't a problem between VS2008 and VS2010 because VS2008 did not use Microsoft.Cpp.Win32.user as a default for new projects.  That was added in VS2010 and has been retained for VS2012 so that both use the same property sheet file as a default for new projects.  That's a problem.

    Basically it means that VS2010 and VS2012 cannot coexist on the same platform if you use the Microsoft.Cpp.Win32.user property sheet file to point to specific folders needed for compiling/linking projects.  That's because both versions use the exact same property sheet file as a default.

    If you had separate development systems for VS2010 and VS2012 then it wouldn't be a problem as you could set Microsoft.Cpp.Win32.user on each system for that VS version.  But I need to have both on the same development system.

    Thursday, August 15, 2013 12:58 PM
  • Appreciate your detailed reply. I'll go through this and get back to you.

    Blog: http://ntcoder.com/bab


    Posts are provided as is without warranties or guaranties.

    Friday, August 16, 2013 1:59 PM
  • I'm following up with devs on this one. There is a related connect bug already logged on this issue...

    http://connect.microsoft.com/VisualStudio/feedback/details/762659/vs2012-c-include-and-library-directories-are-not-set-correctly-in-new-projects


    Blog: http://ntcoder.com/bab


    Posts are provided as is without warranties or guaranties.

    Thursday, August 22, 2013 12:12 PM
  • Hi,

    Can you try the fixes mentioned in:

    http://connect.microsoft.com/VisualStudio/feedback/details/762659/vs2012-c-include-and-library-directories-are-not-set-correctly-in-new-projects

    Does that help you?

    Thank you,

    Nibu


    Blog: http://ntcoder.com/bab


    Posts are provided as is without warranties or guaranties.

    Wednesday, August 28, 2013 12:39 PM
  • Hi Nibu,

    If I understand that "solution" correctly, you DELETE the Microsoft.cpp.Win32.user file altogether so it will not be found and will not be automatically imported into a new project.  Then you have to modify every new solution's .props file to add in path locations for everything.  That doesn't sound any different from what I'm doing as it is a workaround for the general problem which must be done for every new project.

    I'm already removing the Microsoft.cpp.Win32.user file via Property Manager from new VC2012 projects and adding a common custom .props file I created to take the place of Microsoft.Cpp.Win32.user.props.  So their "solution" doesn't seem to accomplish anything different and does not get to the root of the problem which is VC2010 and VC2012 automatically import the exact same  Microsoft.cpp.Win32.user file into new projects.  Any changes made to it will automatically be picked up by BOTH VC2010 and VC2012.  Therefore, you really cannot use Microsoft.cpp.Win32.user to modify the VC++ Directories settings if you need different libraries for VC2010 vs. VC2012.  You have to manually modify every new project.

    In the referenced post, Adam said:

    We automatically import

    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />

    If this were changed to

    <Import Project="$(UserRootDir)\ $(PlatformToolset)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\$(PlatformToolset)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />

    to reference the VC version as a folder under $(UserRootDir) then that would seem to solve everything as it would give you separate Microsoft.Cpp.Win32.user.props files for each version of VC.  But unless VC is changed to do that for new projects, you have to modify every single new project yourself.

    It's not a big deal to remove Microsoft.cpp.Win32.user for a new VC2012 project and add the new common .props I created.  But it just seems you shouldn't have to do that.  VC2012 really was not made to coexist with VC2010 it seems if it is going to use the same inherited property sheet for both versions.

    Thanks,

    Phil

    • Proposed as answer by sw_eng04 Tuesday, September 3, 2013 9:40 PM
    • Unproposed as answer by sw_eng04 Tuesday, September 3, 2013 9:41 PM
    Wednesday, August 28, 2013 2:11 PM
  • Until MS fixes this issue I made a copy of the "C:\Users\????\AppData\Local\Microsoft\MSBuild\v4.0" directory and called it v4.0_vs2012.  I then renamed the "Microsoft.Cpp.Win32.user.prop" to "Microsoft.Cpp.Win32.user_vs2012.prop" just so I know which is different.  Now when I make a new project I add the new prop and remove the default.  I know its still work but its better than making a new prop sheet each time.

    Rich S.

    Tuesday, September 3, 2013 9:47 PM
  • Rich, I'm basically doing the same thing in that I have a new prop sheet I created (CommonVC2012.props) which I add to all new VC2012 projects and I remove the default Microsoft.Cpp.Win32.user.prop sheet that automatically gets added to them.  It's just one prop sheet that I use for all projects - not an individual one for each project.  I can't rename the ...MSBuild\v4.0 folder because VC2010 needs to find it on my system.

    This seems to be a definite problem for anybody developing with both VC2010 and VC2012 on the same system.  I see no way to work around it other than how we have.  MS really needs to add a work around in VC2012 so that you can somehow control the prop sheets that are automatically included in a new project so you can have it use a different one from the one VC2010 is using.

    Phil

    Tuesday, September 3, 2013 10:17 PM
  • If the folks who responded here can respond on the connect bug thread then probably this will be taken up and fixed. As of now very few people have responded on that connect bug thread. Or you can report this issue via a new connect bug and folks who responded here can respond there as well.

    Blog: http://ntcoder.com/bab


    Posts are provided as is without warranties or guaranties.

    Thursday, September 5, 2013 1:59 PM
  • Hi Nibu - I just responded on the connect bug thread as you suggested but that thread is over a year old now and I doubt anyone is even watching it anymore.

    I'm just surprised that everybody with VC2010 and VC2012 installed on the same system is not yelling about this problem since I see no other solution than the manual workaround we're having to use.

    Thanks,

    Phil

    Thursday, September 5, 2013 3:23 PM
  • Probably most of the people are living with it.

    The more noise the better chance to get this fixed. Even if I talk to the devs on this issue, they are going to check what's the impact of this issue on customers. Since the connect bug creator was satisfied the devs probably just left it as it is.

    If you folks can share the impact (as you've been doing in this thread) I guess there is a good chance for a proper look into the issue. 


    Blog: http://ntcoder.com/bab


    Posts are provided as is without warranties or guaranties.

    Thursday, September 5, 2013 3:29 PM
  • Ok, I've just encountered this problem upgrading from 2010 to 2013 and I think I've found a good solution.

    Go to C:\Users\<username>\AppData\Local\Microsoft\MSBuild\v4.0 and edit the Microsoft.Cpp.Win32.user.props file.

    Inside the PropertyGroup element, add a new conditional property for WindowsSDK_LibraryPath_x86 like so:

    <WindowsSDK_LibraryPath_x86 Condition="$(WindowsSDK_LibraryPath_x86) == ''">$(WindowsSdkDir)lib</WindowsSDK_LibraryPath_x86>

    Then update the LibraryDirectories to use $(WindowsSdk_LibraryPath_x86) in it somewhere.

    Everything should now work fine in both VS2010 and VS2013, because in Visual Studio 2013 the conditional property gets ignored due to WindowsSDK_LibraryPath_x86 being set already.  In Visual Studio 2010, this property is not set, and so it gets set to the library location of the windowssdk as previously used by VS2010.

    Apply a similar fix to Microsoft.Cpp.x64.user.props as needed.

    • Edited by imral Tuesday, November 12, 2013 8:04 AM
    • Proposed as answer by imral Tuesday, November 12, 2013 8:05 AM
    Tuesday, November 12, 2013 8:01 AM