<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <CodeAnalysisRuleSet>..\..\NuGet.ruleset</CodeAnalysisRuleSet>
    <RunCodeAnalysis Condition="'$(EnableCodeAnalysis)'=='true'">true</RunCodeAnalysis>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
    <PlatformTarget>x86</PlatformTarget>
    <DebugSymbols>true</DebugSymbols>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
    <PlatformTarget>x86</PlatformTarget>
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
  </PropertyGroup>
  <Import Project="..\..\Build\NuGet.Settings.targets" />
  <PropertyGroup>
    <ProjectGuid>{B34A6632-E627-4B66-8E0A-D2DA3BC96893}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>NuGet</RootNamespace>
    <AssemblyName>NuGet</AssemblyName>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="Microsoft.Build" />
    <Reference Include="Microsoft.Build.Engine" />
    <Reference Include="Microsoft.Build.Framework" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="Microsoft.Web.XmlTransform, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\..\lib\Microsoft.Web.XmlTransform.dll</HintPath>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.ComponentModel.Composition" />
    <Reference Include="System.ComponentModel.DataAnnotations" />
    <Reference Include="System.Core" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Xml" />
    <Reference Include="WindowsBase" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="..\..\Common\MsBuildProjectUtility.cs">
      <Link>Common\MsBuildProjectUtility.cs</Link>
    </Compile>
    <Compile Include="Attributes\CommandAttribute.cs" />
    <Compile Include="Attributes\OptionAttribute.cs" />
    <Compile Include="CommandLineParser.cs" />
    <Compile Include="CommandManager.cs" />
    <Compile Include="Commands\Command.cs" />
    <Compile Include="Commands\ConfigCommand.cs" />
    <Compile Include="Commands\HelpCommandMarkdownTemplate.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>HelpCommandMarkdownTemplate.cshtml</DependentUpon>
    </Compile>
    <Compile Include="Commands\InstallCommand.cs" />
    <Compile Include="Commands\ProjectFactory.cs" />
    <Compile Include="Commands\RestoreCommand.cs" />
    <Compile Include="Commands\SetApiKeyCommand.cs" />
    <Compile Include="Commands\SourcesCommand.cs" />
    <Compile Include="Commands\SpecCommand.cs" />
    <Compile Include="Commands\DeleteCommand.cs" />
    <Compile Include="Commands\HelpCommand.cs" />
    <Compile Include="Commands\ICommand.cs" />
    <Compile Include="Commands\ListCommand.cs" />
    <Compile Include="Commands\PackCommand.cs" />
    <Compile Include="Commands\PushCommand.cs" />
    <Compile Include="Commands\UpdateCommand.cs" />
    <Compile Include="Common\CachedPackageSourceProvider.cs" />
    <Compile Include="Common\MSBuildSolutionParser.cs" />
    <Compile Include="Common\PackageExtractor.cs" />
    <Compile Include="Common\SelfUpdater.cs" />
    <Compile Include="Common\Solution.cs" />
    <Compile Include="Common\ProjectInSolution.cs" />
    <Compile Include="Common\XBuildSolutionParser.cs" />
    <Compile Include="Common\Verbosity.cs" />
    <Compile Include="Common\AggregateRepositoryHelper.cs" />
    <Compile Include="..\..\Common\NuGetConstants.cs">
      <Link>Common\NuGetConstants.cs</Link>
    </Compile>
    <Compile Include="Common\CommandLineConstants.cs" />
    <Compile Include="Common\CommandLineException.cs" />
    <Compile Include="..\..\Common\CommonAssemblyInfo.cs">
      <Link>Properties\CommonAssemblyInfo.cs</Link>
    </Compile>
    <Compile Include="Common\CommandLineRepositoryFactory.cs" />
    <Compile Include="Common\CommandLineUtility.cs" />
    <Compile Include="Common\Console.cs" />
    <Compile Include="Common\ConsoleCredentialProvider.cs" />
    <Compile Include="Common\IConsole.cs" />
    <Compile Include="Common\IMSBuildProjectSystem.cs" />
    <Compile Include="Common\MSBuildProjectSystem.cs" />
    <Compile Include="Common\LocalizedResourceManager.cs" />
    <Compile Include="DebugHelper.cs" />
    <Compile Include="DefaultManifestValuesRule.cs" />
    <Compile Include="DefaultPackageRules.cs" />
    <Compile Include="FileConflictAction.cs" />
    <Compile Include="CommandLineMachineWideSettings.cs" />
    <Compile Include="Commands\DownloadCommandBase.cs" />
    <Compile Include="ISolutionParser.cs" />
    <Compile Include="NuGetCommand.cs">
      <DependentUpon>NuGetCommand.resx</DependentUpon>
    </Compile>
    <Compile Include="PackageSourceBuilder.cs" />
    <Compile Include="Properties\GlobalSuppressions.cs" />
    <Compile Include="NuGetResources.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>NuGetResources.resx</DependentUpon>
    </Compile>
    <Compile Include="Common\PackageSourceProviderExtensions.cs" />
    <Compile Include="Common\ProjectHelper.cs" />
    <Compile Include="Common\ReadOnlyPackageRepository.cs" />
    <Compile Include="Common\ResourceHelper.cs" />
    <Compile Include="Common\TypeHelper.cs" />
    <Compile Include="ICommandManager.cs" />
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
    <Compile Include="..\..\Common\CommonResources.cs">
      <Link>Common\CommonResources.cs</Link>
    </Compile>
    <Compile Include="StrictSemanticVersionValidationRule.cs" />
  </ItemGroup>
  <ItemGroup>
    <CodeAnalysisDictionary Include="..\..\CodeAnalysisDictionary.xml">
      <Link>Properties\CodeAnalysisDictionary.xml</Link>
      <SubType>Designer</SubType>
    </CodeAnalysisDictionary>
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\Core\Core.csproj">
      <Project>{F879F274-EFA0-4157-8404-33A19B4E6AEC}</Project>
      <Name>Core</Name>
    </ProjectReference>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="..\..\Common\CommonResources.resx">
      <Link>Common\CommonResources.resx</Link>
      <DependentUpon>CommonResources.cs</DependentUpon>
      <SubType>Designer</SubType>
    </EmbeddedResource>
    <EmbeddedResource Include="NuGetCommand.resx">
      <SubType>Designer</SubType>
    </EmbeddedResource>
    <EmbeddedResource Include="NuGetResources.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>NuGetResources.Designer.cs</LastGenOutput>
      <SubType>Designer</SubType>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <None Include="Properties\NuGet.CommandLine.nuspec" />
  </ItemGroup>
  <ItemGroup>
    <Content Include="Commands\HelpCommandMarkdownTemplate.cshtml">
      <SubType>Code</SubType>
      <Generator>RazorGenerator</Generator>
      <LastGenOutput>HelpCommandMarkdownTemplate.cs</LastGenOutput>
    </Content>
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <Target Name="MergeExecutable" Inputs="$(OutputPath)\NuGet.Core.dll;$(OutputPath)\NuGet.exe" Outputs="$(OutputPath)Merged\NuGet.exe" Condition=" '$(OS)' == 'Windows_NT'">
    <PropertyGroup>
      <NuGetRoot>$(MsBuildProjectDirectory)\..\..</NuGetRoot>
      <ILMergeExe>$(NuGetRoot)\Tools\ILMerge\ILMerge.exe</ILMergeExe>
      <ILMergeInternalizeIgnoreFile>$(NuGetRoot)\Build\ilmerge.internalize.ignore.txt</ILMergeInternalizeIgnoreFile>
      <ILMergeOutputFile>NuGet.exe</ILMergeOutputFile>
      <ILMergeOutputFilePath>$(OutputPath)Merged\$(ILMergeOutputFile)</ILMergeOutputFilePath>
      <ILMergeOutputFilePathSigned>$(OutputPath)Signed\$(ILMergeOutputFile)</ILMergeOutputFilePathSigned>
      <FrameworkPath>$(ProgramFiles)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0</FrameworkPath>
      <FrameworkPath Condition="'$(MSBuildProgramFiles32)' != ''">$(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0</FrameworkPath>
      <ILMergeCommandArgs>/targetplatform:"v4, $(FrameworkPath)" /internalize:"$(ILMergeInternalizeIgnoreFile)" /target:exe /out:"Merged\$(ILMergeOutputFile)" /log:"Merged\ilmerge.msbuild.log" /allowDup NuGet.exe NuGet.Core.dll Microsoft.Web.XmlTransform.dll</ILMergeCommandArgs>
      <ILMergeCommandArgsSigned>/targetplatform:"v4, $(FrameworkPath)" /internalize:"$(ILMergeInternalizeIgnoreFile)" /target:exe /out:"Signed\$(ILMergeOutputFile)" /log:"Signed\ilmerge.msbuild.log" /allowDup /keyfile:"$(AssemblyOriginatorKeyFile)" /delaysign NuGet.exe NuGet.Core.dll Microsoft.Web.XmlTransform.dll</ILMergeCommandArgsSigned>
    </PropertyGroup>
    <ItemGroup>
      <ILMergeItems Include="$(OutputPath)\*.dll;$(OutputPath)\*.exe" />
    </ItemGroup>
    <MakeDir Directories="$(OutputPath)Merged" Condition="!Exists('$(OutputPath)Merged')" />
    <MakeDir Directories="$(OutputPath)Signed" Condition="!Exists('$(OutputPath)Signed')" />
    <Delete Files="$(ILMergeOutputFilePath)" Condition="Exists($(ILMergeOutputFilePath))" />
    <Delete Files="$(ILMergeOutputFilePathSigned)" Condition="Exists($(ILMergeOutputFilePathSigned))" />
    <!-- ILMerge does not yet support .NET 4.0  http://nitoprograms.blogspot.com/2010/09/using-ilmerge-with-net-40-andor-rx.html /targetplatform:v4,"%ProgramFiles%\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0" -->
    <Error Condition="!Exists('$(FrameworkPath)')" Text="Could not find 4.0 reference assemblies in $(FrameworkPath)" />
    <Exec Command="&quot;$(ILMergeExe)&quot; $(ILMergeCommandArgs)" WorkingDirectory="$(OutputPath)" />
    <!-- produce another signed one if signing assembly -->
    <Exec Condition=" '$(SignASsembly)' == 'true' " Command="&quot;$(ILMergeExe)&quot; $(ILMergeCommandArgsSigned)" WorkingDirectory="$(OutputPath)" />
  </Target>
  <Target Name="AfterBuild">
    <CallTarget Targets="MergeExecutable" />
  </Target>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>
