System.Data.SQLite
Artifact Content
Not logged in

Artifact 07eee0061616c74d80b41173eec249b6b754ce06:


<!--
 *
 * SQLite.NET.targets -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <!--
  ******************************************************************************
  **                          Load Per-User Settings                          **
  ******************************************************************************
  -->

  <!--
      NOTE: If the per-user settings file exists, import it now.  The contained
            settings, if any, will override the default ones provided below.
  -->
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets.user"
          Condition="Exists('$(SQLiteNetDir)\Targets\SQLite.NET.targets.user')" />

  <!--
  ******************************************************************************
  **                         [Fairly] Generic Targets                         **
  ******************************************************************************
  -->

  <Target Name="EmbedExeManifest"
          Condition="'$(EmbedExeManifest)' != 'false' And
                     '$(MSBuildProjectDirectory)' != '' And
                     Exists('$(MSBuildProjectDirectory)\Resources\manifest.xml')"
          Inputs="$(TargetPath);$(MSBuildProjectDirectory)\Resources\manifest.xml"
          Outputs="$(TargetPath).EmbedExeManifest.done">
    <GetFrameworkSDKPath>
      <Output TaskParameter="Path"
              PropertyName="DirForManifestTool" />
    </GetFrameworkSDKPath>

    <Exec Condition="'$(DirForManifestTool)' != '' And
                     HasTrailingSlash('$(DirForManifestTool)') And
                     Exists('$(DirForManifestTool)bin\mt.exe')"
          Command="&quot;$(DirForManifestTool)bin\mt.exe&quot; -manifest &quot;$(MSBuildProjectDirectory)\Resources\manifest.xml&quot; -outputresource:&quot;$(TargetPath)&quot;;1" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).EmbedExeManifest.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="StrongNameSignFrameworkTargetPath"
          Condition="'$(StrongNameSignFrameworkTargetPath)' != 'false' And
                     '$(SignAssembly)' != 'false' And
                     Exists('$(AssemblyOriginatorKeyFile)')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).StrongNameSign.done">
    <GetFrameworkSDKPath>
      <Output TaskParameter="Path"
              PropertyName="DirForStrongName" />
    </GetFrameworkSDKPath>

    <Exec Condition="'$(DirForStrongName)' != '' And
                     HasTrailingSlash('$(DirForStrongName)') And
                     Exists('$(DirForStrongName)bin\sn.exe')"
          Command="&quot;$(DirForStrongName)bin\sn.exe&quot; -Ra &quot;$(TargetPath)&quot; &quot;$(AssemblyOriginatorKeyFile)&quot;" />

    <Touch Condition="'$(DirForStrongName)' != '' And
                      HasTrailingSlash('$(DirForStrongName)') And
                      Exists('$(DirForStrongName)bin\sn.exe')"
           AlwaysCreate="true"
           Files="$(TargetPath).StrongNameSign.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="StrongNameSignSdkToolsTargetPath"
          Condition="'$(StrongNameSignSdkToolsTargetPath)' != 'false' And
                     '$(SignAssembly)' != 'false' And
                     Exists('$(AssemblyOriginatorKeyFile)')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).StrongNameSign.done">
    <Exec Condition="'$(TargetFrameworkSDKToolsDirectory)' != '' And
                     HasTrailingSlash('$(TargetFrameworkSDKToolsDirectory)') And
                     Exists('$(TargetFrameworkSDKToolsDirectory)sn.exe')"
          Command="&quot;$(TargetFrameworkSDKToolsDirectory)sn.exe&quot; -Ra &quot;$(TargetPath)&quot; &quot;$(AssemblyOriginatorKeyFile)&quot;" />

    <Touch Condition="'$(TargetFrameworkSDKToolsDirectory)' != '' And
                      HasTrailingSlash('$(TargetFrameworkSDKToolsDirectory)') And
                      Exists('$(TargetFrameworkSDKToolsDirectory)sn.exe')"
           AlwaysCreate="true"
           Files="$(TargetPath).StrongNameSign.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="CloneAndMark32BitOnlyFrameworkTargetName32"
          Condition="'$(CloneAndMark32BitOnlyFrameworkTargetName32)' != 'false'"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).CloneAndMark32BitOnly.done">
    <GetFrameworkSDKPath>
      <Output TaskParameter="Path"
              PropertyName="DirForCloneAndMark32BitOnly" />
    </GetFrameworkSDKPath>

    <Copy SourceFiles="$(TargetPath)"
          DestinationFiles="$(TargetDir)$(TargetName)32$(TargetExt)" />

    <Copy SourceFiles="$(TargetPath).config"
          DestinationFiles="$(TargetDir)$(TargetName)32$(TargetExt).config"
          Condition="Exists('$(TargetPath).config')" />

    <Exec Condition="'$(DirForCloneAndMark32BitOnly)' != '' And
                     HasTrailingSlash('$(DirForCloneAndMark32BitOnly)') And
                     Exists('$(DirForCloneAndMark32BitOnly)bin\CorFlags.exe')"
          Command="&quot;$(DirForCloneAndMark32BitOnly)bin\CorFlags.exe&quot; &quot;$(TargetDir)$(TargetName)32$(TargetExt)&quot; /32BIT+ /Force 1&gt;NUL" />

    <Exec Condition="'$(DirForCloneAndMark32BitOnly)' != '' And
                     HasTrailingSlash('$(DirForCloneAndMark32BitOnly)') And
                     Exists('$(DirForCloneAndMark32BitOnly)bin\sn.exe')"
          Command="&quot;$(DirForCloneAndMark32BitOnly)bin\sn.exe&quot; -Ra &quot;$(TargetDir)$(TargetName)32$(TargetExt)&quot; &quot;$(AssemblyOriginatorKeyFile)&quot;" />

    <Touch Condition="'$(DirForCloneAndMark32BitOnly)' != '' And
                      HasTrailingSlash('$(DirForCloneAndMark32BitOnly)') And
                      Exists('$(DirForCloneAndMark32BitOnly)bin\CorFlags.exe') And
                      Exists('$(DirForCloneAndMark32BitOnly)bin\sn.exe')"
           AlwaysCreate="true"
           Files="$(TargetPath).CloneAndMark32BitOnly.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="CloneAndMark32BitOnlySdkToolsTargetName32"
          Condition="'$(CloneAndMark32BitOnlySdkToolsTargetName32)' != 'false'"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).CloneAndMark32BitOnly.done">
    <Copy SourceFiles="$(TargetPath)"
          DestinationFiles="$(TargetDir)$(TargetName)32$(TargetExt)" />

    <Copy SourceFiles="$(TargetPath).config"
          DestinationFiles="$(TargetDir)$(TargetName)32$(TargetExt).config"
          Condition="Exists('$(TargetPath).config')" />

    <Exec Condition="'$(TargetFrameworkSDKToolsDirectory)' != '' And
                     HasTrailingSlash('$(TargetFrameworkSDKToolsDirectory)') And
                     Exists('$(TargetFrameworkSDKToolsDirectory)CorFlags.exe')"
          Command="&quot;$(TargetFrameworkSDKToolsDirectory)CorFlags.exe&quot; &quot;$(TargetDir)$(TargetName)32$(TargetExt)&quot; /32BIT+ /Force 1&gt;NUL" />

    <Exec Condition="'$(TargetFrameworkSDKToolsDirectory)' != '' And
                     HasTrailingSlash('$(TargetFrameworkSDKToolsDirectory)') And
                     Exists('$(TargetFrameworkSDKToolsDirectory)sn.exe')"
          Command="&quot;$(TargetFrameworkSDKToolsDirectory)sn.exe&quot; -Ra &quot;$(TargetDir)$(TargetName)32$(TargetExt)&quot; &quot;$(AssemblyOriginatorKeyFile)&quot;" />

    <Touch Condition="'$(TargetFrameworkSDKToolsDirectory)' != '' And
                      HasTrailingSlash('$(TargetFrameworkSDKToolsDirectory)') And
                      Exists('$(TargetFrameworkSDKToolsDirectory)CorFlags.exe') And
                      Exists('$(TargetFrameworkSDKToolsDirectory)sn.exe')"
           AlwaysCreate="true"
           Files="$(TargetPath).CloneAndMark32BitOnly.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="CleanConfigurations"
          Condition="'$(OutputPath)' != '' And
                     HasTrailingSlash('$(OutputPath)') And
                     Exists('$(OutputPath)')">
    <CreateItem Include="$(OutputPath)*.config">
      <Output ItemName="ConfigurationFiles" TaskParameter="Include" />
    </CreateItem>

    <Delete Condition="'@(ConfigurationFiles)' != ''"
            Files="@(ConfigurationFiles)" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="CopyConfigurations"
          Condition="'$(CopyConfigurations)' != 'false' And
                     '$(OutputPath)' != '' And
                     HasTrailingSlash('$(OutputPath)') And
                     Exists('$(OutputPath)')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).CopyConfigurations.done">
    <CreateItem Include="Configurations\*.config" Exclude="Configurations\no_*">
      <Output ItemName="ConfigurationFiles" TaskParameter="Include" />
    </CreateItem>

    <Copy SourceFiles="@(ConfigurationFiles)"
          DestinationFolder="$(OutputPath)" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).CopyConfigurations.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="WrongNetFx"
          Condition="'$(ProjectName)' != ''">
    <Warning Text="Version mismatch for the .NET Framework, skipping project &quot;$(ProjectName)&quot;..." />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="MissingVsSdk"
          Condition="'$(ProjectName)' != ''">
    <Warning Text="The Visual Studio SDK is missing, skipping project &quot;$(ProjectName)&quot;..." />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="ReSignMixedModeAssembly"
          Condition="'$(ReSignMixedModeAssembly)' != 'false' And
                     '$(TargetPath)' != '' And
                     Exists('$(TargetPath)') And
                     '$(INTEROP_KEY_FILE)' != '' And
                     Exists('$(INTEROP_KEY_FILE)')">
    <Exec Condition="'$(TargetFrameworkSDKToolsDirectory)' == '' And
                     '$(FrameworkSDKDir)' != '' And
                     Exists('$(FrameworkSDKDir)Bin\sn.exe')"
          Command="&quot;$(FrameworkSDKDir)Bin\sn.exe&quot; -Ra &quot;$(TargetPath)&quot; &quot;$(INTEROP_KEY_FILE)&quot;" />

    <Exec Condition="'$(TargetFrameworkSDKToolsDirectory)' != '' And
                     Exists('$(TargetFrameworkSDKToolsDirectory)sn.exe')"
          Command="&quot;$(TargetFrameworkSDKToolsDirectory)sn.exe&quot; -Ra &quot;$(TargetPath)&quot; &quot;$(INTEROP_KEY_FILE)&quot;" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="CopyInteropAssembly"
          Condition="'$(CopyInteropAssembly)' != 'false' And
                     '$(OutDir)' != '' And
                     HasTrailingSlash('$(OutDir)') And
                     '$(TargetName)' != '' And
                     '$(BaseConfiguration)' != '' And
                     '$(Platform)' != ''">
    <Exec Command="XCOPY &quot;$(OutDir)$(TargetName).*&quot; &quot;$(OutDir)..\..\$(BaseConfiguration)\bin\$(Platform)\&quot; /D /E /V /I /F /H /Y" />

    <Exec Condition="'$(DoesMachineMatchPlatform)' != 'false'"
          Command="XCOPY &quot;$(OutDir)$(TargetName).*&quot; &quot;$(OutDir)..\..\$(BaseConfiguration)\bin\&quot; /D /E /V /I /F /H /Y" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="DetectBuildTool"
          Condition="'$(DetectBuildTool)' != 'false' And
                     '$(MSBuildBinPath)' != '' And
                     !HasTrailingSlash('$(MSBuildBinPath)')">
    <CreateProperty Condition="Exists('$(MSBuildBinPath)\MSBuild.exe')"
                    Value="MSBuild">
      <Output TaskParameter="Value" PropertyName="BuildTool" />
    </CreateProperty>

    <CreateProperty Condition="Exists('$(MSBuildBinPath)\xbuild.exe')"
                    Value="XBuild">
      <Output TaskParameter="Value" PropertyName="BuildTool" />
    </CreateProperty>

    <CreateProperty Condition="Exists('$(MSBuildBinPath)\MSBuild.dll')"
                    Value="DotNetCore">
      <Output TaskParameter="Value" PropertyName="BuildTool" />
    </CreateProperty>

    <CreateProperty Condition="!Exists('$(MSBuildBinPath)\MSBuild.exe') And
                               !Exists('$(MSBuildBinPath)\xbuild.exe') And
                               !Exists('$(MSBuildBinPath)\MSBuild.dll')"
                    Value="Unknown">
      <Output TaskParameter="Value" PropertyName="BuildTool" />
    </CreateProperty>
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="DetectOperatingSystem"
          Condition="'$(DetectOperatingSystem)' != 'false'">
    <CreateProperty Condition="'$(OS)' == 'Windows_NT'" Value="Windows">
      <Output TaskParameter="Value" PropertyName="OperatingSystem" />
    </CreateProperty>

    <CreateProperty Condition="'$(OS)' == 'Unix'" Value="Unix">
      <Output TaskParameter="Value" PropertyName="OperatingSystem" />
    </CreateProperty>

    <CreateProperty Condition="'$(OS)' == 'OSX'" Value="MacOSX">
      <Output TaskParameter="Value" PropertyName="OperatingSystem" />
    </CreateProperty>

    <CreateProperty Condition="'$(OS)' != 'Windows_NT' And
                               '$(OS)' != 'Unix' And
                               '$(OS)' != 'OSX'"
                    Value="Unknown">
      <Output TaskParameter="Value" PropertyName="OperatingSystem" />
    </CreateProperty>
  </Target>

  <!--
  ******************************************************************************
  **                        Visual Studio 2017 Targets                        **
  ******************************************************************************
  -->

  <Target Name="MaybeFindVsSdk2017"
          Condition="'$(MaybeFindVsSdk2017)' != 'false' And
                     '$(MSBuildProjectDirectory)' != '' And
                     !HasTrailingSlash('$(MSBuildProjectDirectory)') And
                     Exists('$(MSBuildProjectDirectory)\..\Externals\vswhere\vswhere.exe')">
    <!--
        HACK: Use a couple undocumented properties of the Exec task in order
              to capture the console output of the "vswhere" command.  This
              is needed to locate the SDK for Visual Studio 2017.  For more
              information, see:

              https://stackoverflow.com/questions/8938679
    -->
    <Exec ConsoleToMSBuild="true" Command="&quot;$(MSBuildProjectDirectory)\..\Externals\vswhere\vswhere.exe&quot; -version 15.0 -products * -requires Microsoft.VisualStudio.Component.VSSDK -property installationPath"
          WorkingDirectory="$(MSBuildProjectDirectory)\..\Externals\vswhere">
      <Output TaskParameter="ConsoleOutput" PropertyName="VS150INSTALLATIONPATH" />
    </Exec>

    <CreateProperty Condition="'$(VS150INSTALLATIONPATH)' != '' And
                               !HasTrailingSlash('$(VS150INSTALLATIONPATH)') And
                               Exists('$(VS150INSTALLATIONPATH)\VSSDK')"
                    Value="$(VS150INSTALLATIONPATH)\VSSDK\">
      <Output TaskParameter="Value" PropertyName="VSSDK150Install" />
    </CreateProperty>
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="MaybeMissingVsSdk2017"
          Condition="'$(MaybeMissingVsSdk2017)' != 'false' And
                     ('$(VSSDK150Install)' == '' Or
                      !Exists('$(VSSDK150Install)VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.Data.ConnectionUI.dll') Or
                      !Exists('$(VSSDK150Install)VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.VisualStudio.Data.dll') Or
                      !Exists('$(VSSDK150Install)VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.VisualStudio.Data.Services.dll') Or
                      !Exists('$(VSSDK150Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.OLE.Interop.dll') Or
                      !Exists('$(VSSDK150Install)VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.VisualStudio.Shell.15.0.dll') Or
                      !Exists('$(VSSDK150Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.Shell.Interop.dll') Or
                      !Exists('$(VSSDK150Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.Shell.Interop.8.0.dll') Or
                      !Exists('$(VSSDK150Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.Shell.Interop.9.0.dll') Or
                      !Exists('$(VSSDK150Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.Shell.Interop.10.0.dll') Or
                      !Exists('$(VSSDK150Install)VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.VisualStudio.Shell.Interop.15.3.DesignTime.dll'))">
    <!--
        NOTE: We cannot build this project without the necessary reference
              assemblies; therefore, skip building it altogether.
    -->
    <CreateProperty Value="MissingVsSdk">
      <Output TaskParameter="Value" PropertyName="BuildDependsOn" />
    </CreateProperty>
  </Target>
</Project>