Though the Windows 7 RC SDK was released about 2 weeks before Visual Studio 2010 Beta 1, it was not possible to incorporate that release into VS 2010 Beta 1. As a result, the Windows SDK components that ship as part of Visual Studio 2010 Beta 1 are the Windows 7 Beta SDK versions.
This post will describe how you can use the Native Multitargeting feature in Visual Studio 2010 to compile and link your applications against the Windows SDK supporting Windows 7 RC.
Step 1: Download and install the RC SDK from http://www.microsoft.com/downloads/details.aspx?familyid=F75F2CA8-C1E4-4801-9281-2F5F28F12DBD&displaylang=en
Step 2: Add the Windows 7 SDK as a platform target to Visual Studio:
- a) Download the Windows7SDK.zip file attached to this blog post.
- b) Extract the zip file into The Program Files directory (On 64 bit versions of Windows into the Program Files (x86) directory) by opening it up in Explorer and selecting Extract All Files. In the dialog select the appropriate directory. If you are unsure what the Program Files Directory is on your system, you can type %ProgramFiles% (or %ProgramFiles(x86)% for a 64 bit OS) into the Address bar of an Explorer window and press enter. The Address bar will then show the correct path that you can copy and paste. Extract, then answer yes to the question about merging contents of the directories.
- c) After the extract, verify that the directory %ProgramFiles%\ MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\PlatformToolsets\Windows7SDK was created and contains the following 2 files: Microsoft.Cpp.Win32.Windows7SDK.props and Microsoft.Cpp.Win32.Windows7SDK.targets. (For a 64 bit OS, the directory should start at %ProgramFiles(x86)%).
For each project that you want to target at the RC version of the Windows 7 SDK do the following:
- 1) Open the Solution containing the project.
- 2) Right Click the Project node in the Solution Explorer pane and select Properties.
- 3) Select the Configuration Properties, General from the list in the left pane.
- 4) Select All Configurations in the Configuration dropdown.
- 5) Select Windows7SDK in the Platform Toolset option in the right pane under the General category.
Note that the platform configuration we added is just for developing 32-bit applications. One could create a similar Platform for X64 builds, but these are not included here.
We have verified basic correctness, but have not run a comprehensive set of test cases. More specifically this is the level of correctness testing we have done:
Built an MFC app and a Windows Forms app with Dev10 targeting v100
Built an MFC app and a Windows Forms app with Dev10 + WinSDK toolset targeting v100
Built an MFC app and a Windows Forms app with Dev10 + WinSDK toolset targeting WinSDK7RC
Built an MFC app and a Windows Forms app WinForms with Dev10 + WinSDK toolset + WinSDK RC installed and targeting v100
Built an MFC app and a Windows Forms app with Dev10 + WinSDK toolset + WinSDK RC installed and targeting WinSDK7RC
Note that some Windows 7 RC SDK samples do not build in Visual Studio 2010 Beta 1. We are investigating these issues and will publish information about this on the Windows SDK team blog as it becomes available.
We will also be posting specifically about Native Multitargeting in detail in the next couple weeks on the Visual C++ blog. If you are interested in some background information before that, please take a look at the following entry on Soma’s blog giving a brief overview: http://blogs.msdn.com/somasegar/archive/2008/11/21/c-enhancements-in-vs-2010.aspx