Skip to content
Snippets Groups Projects
Select Git revision
  • 241474961bc2a823daab637635d22017a87d5a34
  • master default
  • dependabot/nuget/source/Sample/Newtonsoft.Json-13.0.1
  • dependabot/nuget/source/MasterDevs.ChromeDevTools.Tests/Newtonsoft.Json-13.0.1
  • dependabot/nuget/source/ProtocolGenerator/Newtonsoft.Json-13.0.1
  • dependabot/nuget/source/ChromeDevTools/Newtonsoft.Json-13.0.1
  • dependabot/nuget/source/ChromeDevTools/System.Net.Http-4.3.4
  • revert-29-revert-24-protocol_62
  • revert-24-protocol_62
  • 1.1.0
  • 1.0.2
  • 1.0.1
  • 1.0.0.40915
13 results

NuGet.targets

Blame
  • NuGet.targets 7.31 KiB
    <?xml version="1.0" encoding="utf-8"?>
    <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
        <PropertyGroup>
            <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>
    
            <!-- Enable the restore command to run before builds -->
            <RestorePackages Condition="  '$(RestorePackages)' == '' ">false</RestorePackages>
    
            <!-- Property that enables building a package from a project -->
            <BuildPackage Condition=" '$(BuildPackage)' == '' ">false</BuildPackage>
    
            <!-- Determines if package restore consent is required to restore packages -->
            <RequireRestoreConsent Condition=" '$(RequireRestoreConsent)' != 'false' ">true</RequireRestoreConsent>
    
            <!-- Download NuGet.exe if it does not already exist -->
            <DownloadNuGetExe Condition=" '$(DownloadNuGetExe)' == '' ">false</DownloadNuGetExe>
        </PropertyGroup>
    
        <ItemGroup Condition=" '$(PackageSources)' == '' ">
            <!-- Package sources used to restore packages. By default, registered sources under %APPDATA%\NuGet\NuGet.Config will be used -->
            <!-- The official NuGet package source (https://www.nuget.org/api/v2/) will be excluded if package sources are specified and it does not appear in the list -->
            <!--
                <PackageSource Include="https://www.nuget.org/api/v2/" />
                <PackageSource Include="https://my-nuget-source/nuget/" />
            -->
        </ItemGroup>
    
        <PropertyGroup Condition=" '$(OS)' == 'Windows_NT'">
            <!-- Windows specific commands -->
            <NuGetToolsPath>$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
        </PropertyGroup>
    
        <PropertyGroup Condition=" '$(OS)' != 'Windows_NT'">
            <!-- We need to launch nuget.exe with the mono command if we're not on windows -->
            <NuGetToolsPath>$(SolutionDir).nuget</NuGetToolsPath>
        </PropertyGroup>
    
        <PropertyGroup>
            <PackagesProjectConfig Condition=" '$(OS)' == 'Windows_NT'">$(MSBuildProjectDirectory)\packages.$(MSBuildProjectName.Replace(' ', '_')).config</PackagesProjectConfig>
            <PackagesProjectConfig Condition=" '$(OS)' != 'Windows_NT'">$(MSBuildProjectDirectory)\packages.$(MSBuildProjectName).config</PackagesProjectConfig>
        </PropertyGroup>
    
        <PropertyGroup>
          <PackagesConfig Condition="Exists('$(MSBuildProjectDirectory)\packages.config')">$(MSBuildProjectDirectory)\packages.config</PackagesConfig>
          <PackagesConfig Condition="Exists('$(PackagesProjectConfig)')">$(PackagesProjectConfig)</PackagesConfig>
        </PropertyGroup>
        
        <PropertyGroup>
            <!-- NuGet command -->
            <NuGetExePath Condition=" '$(NuGetExePath)' == '' ">$(NuGetToolsPath)\NuGet.exe</NuGetExePath>
            <PackageSources Condition=" $(PackageSources) == '' ">@(PackageSource)</PackageSources>
    
            <NuGetCommand Condition=" '$(OS)' == 'Windows_NT'">"$(NuGetExePath)"</NuGetCommand>
            <NuGetCommand Condition=" '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 "$(NuGetExePath)"</NuGetCommand>
    
            <PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>
    
            <RequireConsentSwitch Condition=" $(RequireRestoreConsent) == 'true' ">-RequireConsent</RequireConsentSwitch>
            <NonInteractiveSwitch Condition=" '$(VisualStudioVersion)' != '' AND '$(OS)' == 'Windows_NT' ">-NonInteractive</NonInteractiveSwitch>
    
            <PaddedSolutionDir Condition=" '$(OS)' == 'Windows_NT'">"$(SolutionDir) "</PaddedSolutionDir>
            <PaddedSolutionDir Condition=" '$(OS)' != 'Windows_NT' ">"$(SolutionDir)"</PaddedSolutionDir>
    
            <!-- Commands -->
            <RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)"  $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir)</RestoreCommand>
            <BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols</BuildCommand>
    
            <!-- We need to ensure packages are restored prior to assembly resolve -->
            <BuildDependsOn Condition="$(RestorePackages) == 'true'">
                RestorePackages;