<!--
***********************************************************************************************
WindowsDriver.sdv.targets

WARNING:  DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
          created a backup copy.  Incorrect changes to this file will make it
          impossible to load or build your projects from the command-line or the IDE.

This file defines the steps/targets required to build driver projects.

Copyright (C) Microsoft Corporation. All rights reserved.
***********************************************************************************************
-->

<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">  
    <UsingTask TaskName="SetEnv" AssemblyFile="$(MSBuildExtensionsPath)\Microsoft.Cpp\v4.0\V120\Microsoft.Build.CppTasks.Common.V120.dll, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
    
    <Target Name="sdv">
        <Warning Text="Static Driver Verifier (SDV) is no longer included in the Windows Driver Kit and is no longer compatible with VS2022 and later.  To use SDV, install an older version of the EWDK."
        />
    </Target>

    <Target Name="dvl">
        <PropertyGroup>
            <ConfigurationPlatformExists Condition="'%(ProjectConfiguration.Identity)' == '$(Configuration)|$(Platform)'">true</ConfigurationPlatformExists>
        </PropertyGroup>
        <Error text="Configuration/Platform is not present in the project file." Condition="'$(ConfigurationPlatformExists)' != 'true'"/>
        <!-- set security on binaries-->
        <SetEnv Name="PATH"
            Value  = "$(WDKContentRoot)TOOLS\DVL;%PATH%"
            Prefix = "false">      
        </SetEnv>    
        <SetEnv Name="DVL"
            Value  = ""
            Prefix = "false">      
        </SetEnv>
        <SetEnv Name="TargetName_DVL"
            Value  = "$(TargetName)"
            Prefix = "false">      
        </SetEnv>   
        <SetEnv Name="PLATFORM_DVL"
            Value  = "$(Platform)"
            Prefix = "false">      
        </SetEnv>    
         <SetEnv Name="CONFIGURATION_DVL"
            Value  = "$(Configuration)"
            Prefix = "false">      
        </SetEnv>    
        <SetEnv Name="USEDEBUGLIBRARIES_DVL"
            Value  = "$(UseDebugLibraries)"
            Prefix = "false">      
        </SetEnv>    
        <SetEnv Name="OutDir_DVL"
            Value  = "$(OutDir)"
            Prefix = "false">      
        </SetEnv>    
        <SetEnv Name="IntDir_DVL"
            Value  = "$(IntDir)"
            Prefix = "false">      
        </SetEnv>   
         <SetEnv Name="USEDEBUGLIBRARIES_SDV"
            Value  = "$(UseDebugLibraries)"
            Prefix = "false">      
        </SetEnv>    
        <Exec Command="dvl.exe /create"
              WorkingDirectory="$(MSBuildStartupDirectory)"
        />
    </Target>
  
</Project>
