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:
For each project that you want to target at the RC version of the Windows 7 SDK do the following:
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 v100Built an MFC app and a Windows Forms app with Dev10 + WinSDK toolset targeting v100Built an MFC app and a Windows Forms app with Dev10 + WinSDK toolset targeting WinSDK7RCBuilt an MFC app and a Windows Forms app WinForms with Dev10 + WinSDK toolset + WinSDK RC installed and targeting v100Built 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
And if you want to get VS2010 Beta 1 then Soma has all the details: http://blogs.msdn.com/somasegar/archive/2009/05/18/visual-studio-2010-and-net-fx-4-beta-1-ships.aspx
Just to be clear, is it a supported scenario to use the Windows SDK includes and libs with the stock Visual C++ toolset? The reason I ask is that I've had some headaches recently with the SDK's <winnt.h> declaring intrinsics in a manner incompatible with <intrin.h>, and was wondering if the SDK headers were officially supported only with the SDK toolset.
I just installed the beta, and I'm a bit surprised to see that property sheets are still there. Weren't the MSBuild .targets files supposed to replace them? Care to enlighten us? :)
@Jalf: both are valid statements :) property sheets are still there and they are MSBuild files. More specifically .props files.
The .props extension is a convention to represent MSBuild files that only contain properties, item definitions and items but no target definitions.
During conversion, your .vsprops files (VC property sheets) will get converted to semantically equivalent .props files.
Our overall goal was to ease migration from previous versions - you will notice that most of the VC Project System features are still there even if now under the covers they are expressed in MSBuild terms (i.e. property sheets, custom build rules, property inheritance in Property Pages, single file builds, etc.)
Thanks for the explanation. :)
I did notice that the extension had changed, and that the contents looked different in a text editor.
What had me confused was that there are still build options that are not exposed through the property pages for a property sheet (such as switching unicode on/off, or changing between .exe/.dll/.lib), but which should be possible to override with the new MSBuild build system.
So can I simply edit the .props file manually to specify those missing options? (Would be a lot nicer if I could simply include a .props file to build a static library instead of an executable. That was pretty much the scenario that sold me on the idea of switching to MSBuild)
Even though the configuration files for building an X64 application targeting the Windows 7 RC SDK are not included in the ZIP above, it's easy to derive their contents judging from the differences between Microsoft.Cpp.Win32.v100.props and Microsoft.Cpp.X64.v100.props.
The contents of Microsoft.Cpp.X64.Windows7SDK.props would be the following:
<Import Project="$(VCTargetsPath)\Platforms\X64\PlatformToolsets\v100\Microsoft.Cpp.X64.v100.props" />
<WindowsSdkDev10Dir Condition="'$(UseEnv)' != 'true'">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A@InstallationFolder)</WindowsSdkDev10Dir>
<WindowsSdkDir Condition="'$(UseEnv)' != 'true'">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0@InstallationFolder)</WindowsSdkDir>
<ExecutablePath>$(VCInstallDir)bin\x86_amd64;$(VCInstallDir)bin;$(WindowsSdkDev10Dir)\bin\NETFX 4.0 Tools;$(WindowsSDKDir)\bin;$(VSInstallDir)Common7\Tools\bin;$(VSInstallDir)Common7\tools;$(VSInstallDir)Common7\ide;$(ProgramFiles)\HTML Help Workshop;$(FrameworkSDKDir)bin;$(FrameworkSDKDir)lib\win64;$(MSBuildToolsPath);$(FxCopDir);$(PATH);</ExecutablePath>
The other file, Microsoft.Cpp.X64.Windows7SDK.targets, would be identical to Microsoft.Cpp.Win32.Windows7SDK.targets, so you can just copy it and rename it.
Put both files under the MSBuild\Microsoft.Cpp\v4.0\Platforms\X64\PlatformToolsets\Windows7SDK directory and you'll be able to build an X64 application using the Windows 7 RC SDK. I tried building a simple X64 project and it worked fine on a Windows Server 2008 R2 RC virtual machine.
Phaeron - If you're asking whether it's a supported scenario to install Visual Studio and install a Windows SDK release and then use the headers and libraries that ship with the Windows SDK release while creating apps using Visual Studio, the answer is yes. If you are having problems with the headers that the SDK ships while you're writing code using Visual Studio, we want to know what the problems are so we can investigate. Does that answer your question?
> I've had some headaches recently with the SDK's
> <winnt.h> declaring intrinsics in a manner
> incompatible with <intrin.h>
We've had the same headaches. VC10's <intrin.h> is finally compatible with <winnt.h>.
I spent some time looking at the various .target files supporting the new C++ build system to get a grip of how it works, and noticed that the compiler and linker are compiled tasks - not defined entirely in XML as originally envisioned. Is this design final? I am trying to see how I would go about making a custom VC6 platform toolset for a legacy embedded platform, and having to write cusom task assemblies really complicates things. Simply being able to adapt existing XML files would be ideal.
Related question: How does the new MSBuild system do dependency analysis of header files? Is it even possible without custom compiled tasks?
Does this break .NET Framework 4.0 development?
@David: relying on XAML based tasks for build extension implementations is a supported scenario and something we'd like to get your feedback on.
We don't plan though to use XAMLTaskFactory for VC shipping tasks as there is some functionality needed that we don't plan to add to XAMLTaskFactory:
- dependency analysis (i.e. track header files)
- parent/child property relations
- build cancellation.
For dependency analysis, VC tasks use FileTracker which is a new feature in MSBuild 4.0. We'll share more information as more of our documentation becomes available. This will be something 3rd party task developers will be able to take advantage as well.
PS: I'd love to chat more about the VC6 platform toolset project you're working on if you'd like. Can you send me an email to mluparu at microsoft.com?
Wondering how to use the new Windows 7 SDK with Visual Studio 2010 Beta1? The Windows 7 SDK Beta version
I see this is only for C++ .. is there any way to use Win7 RC SDK with C#?
(i know you C++ guys are smart enough to make it happen)
erm ... C# 2010 Beta 1 that is
This is very good news was well informed that the followers of the issue I am. Thanks...