Commit 7beaa238 authored by Sandeepa J.A.G.P's avatar Sandeepa J.A.G.P

commit

parent f0db7249
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<RoslynToolPath Condition=" '$(RoslynToolPath)' == '' ">$(MSBuildThisFileDirectory)..\..\tools\roslyn45</RoslynToolPath>
</PropertyGroup>
</Project>
\ No newline at end of file
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.Extensions.props"/>
<ItemGroup>
<RoslynCompilerFiles Include="$(RoslynToolPath)\*">
<Link>roslyn\%(RecursiveDir)%(Filename)%(Extension)</Link>
</RoslynCompilerFiles>
</ItemGroup>
<Target Name="IncludeRoslynCompilerFilesToFilesForPackagingFromProject" BeforeTargets="PipelineCollectFilesPhase" >
<ItemGroup>
<FilesForPackagingFromProject Include="@(RoslynCompilerFiles)">
<DestinationRelativePath>bin\roslyn\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
<FromTarget>IncludeRoslynCompilerFilesToFilesForPackagingFromProject</FromTarget>
<Category>Run</Category>
</FilesForPackagingFromProject>
</ItemGroup>
</Target>
<Target Name="LocateRoslynToolsDestinationFolder" Condition=" '$(RoslynToolsDestinationFolder)' == '' ">
<PropertyGroup>
<RoslynToolsDestinationFolder>$(WebProjectOutputDir)\bin\roslyn</RoslynToolsDestinationFolder>
<RoslynToolsDestinationFolder Condition=" '$(WebProjectOutputDir)' == '' ">$(OutputPath)\roslyn</RoslynToolsDestinationFolder>
</PropertyGroup>
</Target>
<Target Name="CopyRoslynCompilerFilesToOutputDirectory" AfterTargets="CopyFilesToOutputDirectory" DependsOnTargets="LocateRoslynToolsDestinationFolder">
<Copy SourceFiles="@(RoslynCompilerFiles)" DestinationFolder="$(RoslynToolsDestinationFolder)" ContinueOnError="true" SkipUnchangedFiles="true" Retries="0" />
<ItemGroup Condition="'$(MSBuildLastTaskResult)' == 'True'" >
<FileWrites Include="$(RoslynToolsDestinationFolder)\*" />
</ItemGroup>
</Target>
<Target Name="CheckIfShouldKillVBCSCompiler">
<CheckIfVBCSCompilerWillOverride src="$(RoslynToolPath)\VBCSCompiler.exe" dest="$(RoslynToolsDestinationFolder)\VBCSCompiler.exe">
<Output TaskParameter="WillOverride" PropertyName="ShouldKillVBCSCompiler" />
</CheckIfVBCSCompilerWillOverride>
</Target>
<Target Name = "KillVBCSCompilerBeforeCopy" BeforeTargets="CopyRoslynCompilerFilesToOutputDirectory" DependsOnTargets="LocateRoslynToolsDestinationFolder;CheckIfShouldKillVBCSCompiler" >
<KillProcess ProcessName="VBCSCompiler" ImagePath="$(RoslynToolsDestinationFolder)" Condition="'$(ShouldKillVBCSCompiler)' == 'True'" />
</Target>
<Target Name = "KillVBCSCompilerBeforeClean" AfterTargets="BeforeClean" DependsOnTargets="LocateRoslynToolsDestinationFolder">
<KillProcess ProcessName="VBCSCompiler" ImagePath="$(RoslynToolsDestinationFolder)" />
</Target>
<UsingTask TaskName="KillProcess" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<ProcessName ParameterType="System.String" Required="true" />
<ImagePath ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Reference Include="System" />
<Reference Include="System.Management" />
<Using Namespace="System" />
<Using Namespace="System.Linq" />
<Using Namespace="System.Diagnostics" />
<Using Namespace="System.Management" />
<Code Type="Fragment" Language="cs">
<![CDATA[
try
{
foreach(var p in Process.GetProcessesByName(ProcessName))
{
var wmiQuery = "SELECT ProcessId, ExecutablePath FROM Win32_Process WHERE ProcessId = " + p.Id;
using(var searcher = new ManagementObjectSearcher(wmiQuery))
{
using(var results = searcher.Get())
{
var mo = results.Cast<ManagementObject>().FirstOrDefault();
if(mo != null)
{
var path = (string)mo["ExecutablePath"];
var executablePath = path != null ? path : string.Empty;
Log.LogMessage("ExecutablePath is {0}", executablePath);
if(executablePath.StartsWith(ImagePath, StringComparison.OrdinalIgnoreCase))
{
p.Kill();
p.WaitForExit();
Log.LogMessage("{0} is killed", executablePath);
break;
}
}
}
}
}
}
catch (Exception ex)
{
Log.LogWarning(ex.Message);
}
return true;
]]>
</Code>
</Task>
</UsingTask>
<UsingTask TaskName="CheckIfVBCSCompilerWillOverride" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<Src ParameterType="System.String" Required="true" />
<Dest ParameterType="System.String" Required="true" />
<WillOverride ParameterType="System.Boolean" Output="true" />
</ParameterGroup>
<Task>
<Reference Include="System.IO" />
<Code Type="Fragment" Language="cs">
<![CDATA[
WillOverride = false;
try {
WillOverride = File.Exists(Src) && File.Exists(Dest) && (File.GetLastWriteTime(Src) != File.GetLastWriteTime(Dest));
}
catch { }
]]>
</Code>
</Task>
</UsingTask>
</Project>
\ No newline at end of file
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<RoslynToolPath Condition=" '$(RoslynToolPath)' == '' ">$(MSBuildThisFileDirectory)..\..\tools\roslynlatest</RoslynToolPath>
</PropertyGroup>
</Project>
\ No newline at end of file
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.Extensions.props"/>
<ItemGroup>
<RoslynCompilerFiles Include="$(RoslynToolPath)\*">
<Link>roslyn\%(RecursiveDir)%(Filename)%(Extension)</Link>
</RoslynCompilerFiles>
</ItemGroup>
<Target Name="IncludeRoslynCompilerFilesToFilesForPackagingFromProject" BeforeTargets="PipelineCollectFilesPhase" >
<ItemGroup>
<FilesForPackagingFromProject Include="@(RoslynCompilerFiles)">
<DestinationRelativePath>bin\roslyn\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
<FromTarget>IncludeRoslynCompilerFilesToFilesForPackagingFromProject</FromTarget>
<Category>Run</Category>
</FilesForPackagingFromProject>
</ItemGroup>
</Target>
<Target Name="LocateRoslynToolsDestinationFolder" Condition=" '$(RoslynToolsDestinationFolder)' == '' ">
<PropertyGroup>
<RoslynToolsDestinationFolder>$(WebProjectOutputDir)\bin\roslyn</RoslynToolsDestinationFolder>
<RoslynToolsDestinationFolder Condition=" '$(WebProjectOutputDir)' == '' ">$(OutputPath)\roslyn</RoslynToolsDestinationFolder>
</PropertyGroup>
</Target>
<Target Name="CopyRoslynCompilerFilesToOutputDirectory" AfterTargets="CopyFilesToOutputDirectory" DependsOnTargets="LocateRoslynToolsDestinationFolder">
<Copy SourceFiles="@(RoslynCompilerFiles)" DestinationFolder="$(RoslynToolsDestinationFolder)" ContinueOnError="true" SkipUnchangedFiles="true" Retries="0" />
<ItemGroup Condition="'$(MSBuildLastTaskResult)' == 'True'" >
<FileWrites Include="$(RoslynToolsDestinationFolder)\*" />
</ItemGroup>
</Target>
<Target Name="CheckIfShouldKillVBCSCompiler">
<CheckIfVBCSCompilerWillOverride src="$(RoslynToolPath)\VBCSCompiler.exe" dest="$(RoslynToolsDestinationFolder)\VBCSCompiler.exe">
<Output TaskParameter="WillOverride" PropertyName="ShouldKillVBCSCompiler" />
</CheckIfVBCSCompilerWillOverride>
</Target>
<Target Name = "KillVBCSCompilerBeforeCopy" BeforeTargets="CopyRoslynCompilerFilesToOutputDirectory" DependsOnTargets="LocateRoslynToolsDestinationFolder;CheckIfShouldKillVBCSCompiler" >
<KillProcess ProcessName="VBCSCompiler" ImagePath="$(RoslynToolsDestinationFolder)" Condition="'$(ShouldKillVBCSCompiler)' == 'True'" />
</Target>
<Target Name = "KillVBCSCompilerBeforeClean" AfterTargets="BeforeClean" DependsOnTargets="LocateRoslynToolsDestinationFolder">
<KillProcess ProcessName="VBCSCompiler" ImagePath="$(RoslynToolsDestinationFolder)" />
</Target>
<UsingTask TaskName="KillProcess" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<ProcessName ParameterType="System.String" Required="true" />
<ImagePath ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Reference Include="System" />
<Reference Include="System.Management" />
<Using Namespace="System" />
<Using Namespace="System.Linq" />
<Using Namespace="System.Diagnostics" />
<Using Namespace="System.Management" />
<Code Type="Fragment" Language="cs">
<![CDATA[
try
{
foreach(var p in Process.GetProcessesByName(ProcessName))
{
var wmiQuery = "SELECT ProcessId, ExecutablePath FROM Win32_Process WHERE ProcessId = " + p.Id;
using(var searcher = new ManagementObjectSearcher(wmiQuery))
{
using(var results = searcher.Get())
{
var mo = results.Cast<ManagementObject>().FirstOrDefault();
if(mo != null)
{
var path = (string)mo["ExecutablePath"];
var executablePath = path != null ? path : string.Empty;
Log.LogMessage("ExecutablePath is {0}", executablePath);
if(executablePath.StartsWith(ImagePath, StringComparison.OrdinalIgnoreCase))
{
p.Kill();
p.WaitForExit();
Log.LogMessage("{0} is killed", executablePath);
break;
}
}
}
}
}
}
catch (Exception ex)
{
Log.LogWarning(ex.Message);
}
return true;
]]>
</Code>
</Task>
</UsingTask>
<UsingTask TaskName="CheckIfVBCSCompilerWillOverride" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<Src ParameterType="System.String" Required="true" />
<Dest ParameterType="System.String" Required="true" />
<WillOverride ParameterType="System.Boolean" Output="true" />
</ParameterGroup>
<Task>
<Reference Include="System.IO" />
<Code Type="Fragment" Language="cs">
<![CDATA[
WillOverride = false;
try {
WillOverride = File.Exists(Src) && File.Exists(Dest) && (File.GetLastWriteTime(Src) != File.GetLastWriteTime(Dest));
}
catch { }
]]>
</Code>
</Task>
</UsingTask>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<appSettings xdt:Transform="InsertIfMissing">
</appSettings>
<appSettings>
<add key="aspnet:RoslynCompilerLocation" xdt:Transform="Remove" xdt:Locator="Match(key)" />
<add key="aspnet:RoslynCompilerLocation" value="roslyn" xdt:Transform="Insert" />
</appSettings>
<!-- If system.codedom tag is absent -->
<system.codedom xdt:Transform="InsertIfMissing">
</system.codedom>
<!-- If compilers tag is absent -->
<system.codedom>
<compilers xdt:Transform="InsertIfMissing">
</compilers>
</system.codedom>
<!-- If a .cs compiler is already present, the existing entry needs to be removed before inserting the new entry -->
<system.codedom>
<compilers>
<compiler
extension=".cs"
xdt:Transform="Remove"
xdt:Locator="Match(extension)" />
</compilers>
</system.codedom>
<!-- Inserting the new compiler -->
<system.codedom>
<compilers>
<compiler
language="c#;cs;csharp"
extension=".cs"
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
warningLevel="4"
compilerOptions="/langversion:6 /nowarn:1659;1699;1701"
xdt:Transform="Insert" />
</compilers>
</system.codedom>
<!-- If a .vb compiler is already present, the existing entry needs to be removed before inserting the new entry -->
<system.codedom>
<compilers>
<compiler
extension=".vb"
xdt:Transform="Remove"
xdt:Locator="Match(extension)" />
</compilers>
</system.codedom>
<!-- Inserting the new compiler -->
<system.codedom>
<compilers>
<compiler
language="vb;vbs;visualbasic;vbscript"
extension=".vb"
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
warningLevel="4"
compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+"
xdt:Transform="Insert" />
</compilers>
</system.codedom>
</configuration>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment