Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the Windows SDK folder in MSBuild?

What would be the way to retrieve the Windows SDK folder in an MSBuild task?

Using the generateBootstrapper task I'm creating a bootstrapper for my setup to be able to install the pre-requisites. This task needs the path to the folder where the pre-requisite packages are located, i.e. the Windows SDK folder

"C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\" 

when using Visual Studio 2008. So far I have been using a hard-coded path but this won't work on any system. Is there a better way to get the path?

This is my build script:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"           ToolsVersion="3.5">     <ItemGroup>         <BootstrapperFile Include="Microsoft.Net.Framework.2.0">             <ProductName>.NET Framework 2.0</ProductName>         </BootstrapperFile>         <BootstrapperFile Include="Microsoft.Windows.Installer.3.1">             <ProductName>Windows Installer 3.1</ProductName>         </BootstrapperFile>     </ItemGroup>      <Target Name="Bootstrapper">         <GenerateBootstrapper ApplicationFile="mySetup.msi"              Culture="de-DE"              ApplicationName="My Application"              OutputPath="$(OutDir)\de-DE"              BootstrapperItems="@(BootstrapperFile)"              Path="C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\" />          <GenerateBootstrapper ApplicationFile="mySetup.msi"              Culture="en-US"              ApplicationName="My Application"              OutputPath="$(OutDir)\en-US"              BootstrapperItems="@(BootstrapperFile)"              Path="C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\" />     </Target> </Project> 
like image 918
Dirk Vollmar Avatar asked Jan 14 '09 10:01

Dirk Vollmar


People also ask

Where is Microsoft SDK folder?

By default, the Windows 10 SDK is installed into the "C:\Program Files (x86)\Windows Kits\10" folder.

How do I get Windows SDK?

You can get the Windows SDK in two ways: install it from this page by selecting the download link or by selecting “Windows 11 SDK (10.0. 22621.0)” in the optional components of the Visual Studio 2022 Installer. Before you install this SDK: Review all system requirements.

How do I know if Windows SDK is installed?

Look under Control Panel / Uninstall a program. "Windows Software Development Kit - Windows X.X.X.X" (where X.X.X.X is the version). It will be listed amongst all the other software you have installed on your machine. Save this answer.

Where is Windowssdk_includepath defined?

Common. props in folder C:\Program Files (x86)\MSBuild\Microsoft.


1 Answers

You can also use the GetFrameworkSdkPath MSBuild task.

<GetFrameworkSdkPath>   <Output TaskParameter="Path" PropertyName="WindowsSdkPath" /> </GetFrameworkSdkPath>   

For example:

<GenerateBootstrapper    ApplicationFile="$(SolutionName).application"   ApplicationName="$(ClickOnceAppTitle)"   ApplicationUrl="$(ClickOnceUrl)"   BootstrapperItems="@(BootstrapperFile)"   Culture="en"   FallbackCulture="en-US"   Path="$(WindowsSDKPath)"   OutputPath="." />  
like image 139
Jeremy D Avatar answered Sep 19 '22 16:09

Jeremy D