<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>9.0.30729</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{8B2BF0D0-5552-46AB-BC42-A8E9894EF9A7}</ProjectGuid>
    <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>ConditionalFormatting.Web</RootNamespace>
    <AssemblyName>ConditionalFormatting.Web.5</AssemblyName>
    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
    <SilverlightApplicationList>{98AC8187-C9DE-4E62-9D20-64DF6372F1A6}|..\ConditionalFormatting\ConditionalFormatting.5.csproj|ClientBin|False</SilverlightApplicationList>
    <FileUpgradeFlags>
    </FileUpgradeFlags>
    <UpgradeBackupLocation>
    </UpgradeBackupLocation>
    <OldToolsVersion>4.0</OldToolsVersion>
    <TargetFrameworkProfile />
    
    
    
    
    <UseIISExpress>false</UseIISExpress>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\</OutputPath>
    <DefineConstants>DEBUG;TRACE;SL5</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\</OutputPath>
    <DefineConstants>TRACE;SL5</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
  </PropertyGroup>
  <PropertyGroup>
    <OLAP_MSBuildToolsVersion>v4.0</OLAP_MSBuildToolsVersion>
    <OLAP_MSBuildToolsVersion Condition="$(VisualStudioVersion) != '10.0' And $(VisualStudioVersion) != '11.0'">v12.0</OLAP_MSBuildToolsVersion>
    <OLAP_MSBuildToolsVersion Condition="$(VisualStudioVersion) == '14.0'">Core</OLAP_MSBuildToolsVersion>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Core">
    </Reference>
    <Reference Include="System.Data.DataSetExtensions">
    </Reference>
    <Reference Include="System.Web.Extensions">
    </Reference>
    <Reference Include="System.Xml.Linq">
    </Reference>
    <Reference Include="System.Drawing" />
    <Reference Include="System.Web" />
    <Reference Include="System.Xml" />
    <Reference Include="System.Configuration" />
    <Reference Include="System.Web.Services" />
    <Reference Include="System.EnterpriseServices" />
    <Reference Include="System.Web.Mobile" />
  </ItemGroup>
  <ItemGroup>
    <Content Include="ClientBin\ConditionalFormatting.5.xap" />
    <Content Include="Default.5.aspx" />
    <Content Include="ConditionalFormattingTestPage.html" />
    <Content Include="Silverlight.js" />
    <Content Include="Web.config" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <ItemGroup>
    <Folder Include="App_Data\" />
  </ItemGroup>
  <PropertyGroup>
    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
  </PropertyGroup>
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
  <!-- 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>
  -->
  <ProjectExtensions>
    <VisualStudio>
      <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
        <WebProjectProperties>
          <UseIIS>False</UseIIS>
          <AutoAssignPort>True</AutoAssignPort>
          <DevelopmentServerPort>6385</DevelopmentServerPort>
          <DevelopmentServerVPath>/</DevelopmentServerVPath>
          <IISUrl>
          </IISUrl>
          <NTLMAuthentication>False</NTLMAuthentication>
          <UseCustomServer>False</UseCustomServer>
          <CustomServerUrl>
          </CustomServerUrl>
          <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
        </WebProjectProperties>
      </FlavorProperties>
    </VisualStudio>
  </ProjectExtensions>
  <ItemGroup>
    <Compile Include="PlatformUriTranslator.cs" />
  </ItemGroup>
  <PropertyGroup>
    <PreBuildEvent>IF EXIST "$(TargetDir)ConditionalFormatting.Web.dll" (del /F "$(TargetDir)ConditionalFormatting.Web.dll")</PreBuildEvent>
  </PropertyGroup>
  <UsingTask TaskName="CorrectNet4BamlNamesInline" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.$(OLAP_MSBuildToolsVersion).dll">
    <ParameterGroup>
      <Sources ParameterType="Microsoft.Build.Framework.ITaskItem[]" Required="true" />
      <Outputs ParameterType="Microsoft.Build.Framework.ITaskItem[]" Output="true" />
      <ResDictNameSuffix ParameterType="System.String" Required="true" />
      <ResDictNameExtension ParameterType="System.String" Required="true" />
      <BuildingProject />
    </ParameterGroup>
    <Task>
      <Reference Include="System.Xml" />
      <Reference Include="$(MSBuildToolsPath)\Microsoft.Build.Framework.dll" />
      <Reference Include="$(MSBuildToolsPath)\Microsoft.Build.Tasks.$(OLAP_MSBuildToolsVersion).dll" />
      <Reference Include="$(MSBuildToolsPath)\Microsoft.Build.Utilities.$(OLAP_MSBuildToolsVersion).dll" />
      <Using Namespace="System" />
      <Using Namespace="System.IO" />
      <Using Namespace="System.Collections.Generic" />
      <Using Namespace="System.Diagnostics.CodeAnalysis" />
      <Using Namespace="System.Linq" />
      <Using Namespace="System.Text" />
      <Using Namespace="Microsoft.Build.Utilities" />
      <Using Namespace="Microsoft.Build.Framework" />
      <Using Namespace="System.Diagnostics" />
      <Using Namespace="System.Xml.Linq" />
      <Using Namespace="System.Globalization" />
      <Code Type="Class" Language="cs">
          
public class CorrectNet4BamlNamesInline : Microsoft.Build.Utilities.Task
    {
        System.Collections.Generic.List&lt;Microsoft.Build.Framework.ITaskItem&gt; _outputs = new System.Collections.Generic.List&lt;Microsoft.Build.Framework.ITaskItem&gt;();

        [Microsoft.Build.Framework.Required]
        public string ResDictNameSuffix { get; set; }
        
        [Microsoft.Build.Framework.Required]
        public string ResDictNameExtension { get; set; }
        
        [Microsoft.Build.Framework.Required]
        public Microsoft.Build.Framework.ITaskItem[] Sources { get; set; }

		[Microsoft.Build.Framework.Output]
		public Microsoft.Build.Framework.ITaskItem[] Outputs
        {
            get
            {
                return _outputs.ToArray();
            }

            set
            {
                _outputs.AddRange(value);
            }
        }

        public string BuildingProject { get; set; }

        public override bool Execute()
        {
            string project = BuildingProject ?? "";
            _outputs.Clear();
            if (Sources == null || Sources.Length == 0)
                return true;
            foreach (Microsoft.Build.Framework.ITaskItem item in Sources)
            {
                Microsoft.Build.Framework.ITaskItem newItem = new Microsoft.Build.Utilities.TaskItem(item);
                _outputs.Add(newItem);
                string srcLink = newItem.GetMetadata("Link");
                string path = string.IsNullOrEmpty(srcLink) ? item.ItemSpec : srcLink;
                string suffix = ResDictNameSuffix + "." + ResDictNameExtension;
                if (path.EndsWith(suffix, System.StringComparison.OrdinalIgnoreCase))
                {
                    string link = path.Remove(path.Length - suffix.Length, ResDictNameSuffix.Length);
                    newItem.SetMetadata("Link", link);
                }
            }

            return true;
        }

    }

        </Code>
    </Task>
  </UsingTask>
  <PropertyGroup>
    <PrepareResourcesDependsOn>BeforeBuild;;C1RenameXamlResDicts;$(PrepareResourcesDependsOn)</PrepareResourcesDependsOn>
  </PropertyGroup>
  <Target Name="C1RenameXamlResDicts">
    <ItemGroup>
      <_convertedXaml Remove="@(_convertedXaml)" />
    </ItemGroup>
    <CorrectNet4BamlNamesInline Sources="@(Resource)" BuildingProject="$(MSBuildProjectFullPath)" ResDictNameSuffix="_SL5rd" ResDictNameExtension="xaml">
      <Output TaskParameter="Outputs" ItemName="_convertedXaml" />
    </CorrectNet4BamlNamesInline>
    <ItemGroup>
      <Resource Remove="@(Resource)" />
      <Resource Include="@(_convertedXaml)" />
      <_convertedXaml Remove="@(_convertedXaml)" />
    </ItemGroup>
    <CorrectNet4BamlNamesInline Sources="@(EmbeddedResource)" BuildingProject="$(MSBuildProjectFullPath)" ResDictNameSuffix="_SL5rd" ResDictNameExtension="xaml">
      <Output TaskParameter="Outputs" ItemName="_convertedXaml" />
    </CorrectNet4BamlNamesInline>
    <ItemGroup>
      <EmbeddedResource Remove="@(EmbeddedResource)" />
      <EmbeddedResource Include="@(_convertedXaml)" />
      <_convertedXaml Remove="@(_convertedXaml)" />
    </ItemGroup>
  </Target>
</Project>