Skip to content

Commit

Permalink
Merge pull request #11 from aspnet/dev_fixpackageissue
Browse files Browse the repository at this point in the history
Fixing issue#2 & issue#10
  • Loading branch information
HongGit authored Aug 2, 2017
2 parents f753071 + bab3400 commit ccd373a
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,69 @@
<Link>roslyn\%(RecursiveDir)%(Filename)%(Extension)</Link>
</RoslyCompilerFiles>
</ItemGroup>
<Target Name="IncludeRoslynCompilerFilesToItemGroup" AfterTargets="ResolveAssemblyReferences" >
<Target Name="RoslynCompilerFilesToPublish">
<ItemGroup>
<None Include="@(RoslyCompilerFiles)" Condition="">
<Link>%(RoslyCompilerFiles.Link)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<_RoslynFiles Include="@(RoslyCompilerFiles)" />
<FilesForPackagingFromProject Include="%(_RoslynFiles.Identity)">
<DestinationRelativePath>bin\roslyn\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
</FilesForPackagingFromProject>
</ItemGroup>
</Target>
<PropertyGroup>
<CopyAllFilesToSingleFolderForPackageDependsOn>
RoslynCompilerFilesToPublish;
$(CopyAllFilesToSingleFolderForPackageDependsOn);
</CopyAllFilesToSingleFolderForPackageDependsOn>
</PropertyGroup>
<Target Name="CopyRoslynCompilerFilesToOutputDirectory" AfterTargets="CopyFilesToOutputDirectory">
<Copy SourceFiles="@(RoslyCompilerFiles)" DestinationFolder="$(OutDir)roslyn" ContinueOnError="true" SkipUnchangedFiles="true" />
<Copy SourceFiles="@(RoslyCompilerFiles)" DestinationFolder="$(WebProjectOutputDir)\bin\roslyn" ContinueOnError="true" SkipUnchangedFiles="true" Retries="0" />
</Target>
<Target Name = "KillVBCSCompilerAndRetryCopy" AfterTargets="CopyRoslynCompilerFilesToOutputDirectory" Condition="'$(MSBuildLastTaskResult)' == 'False'" >
<KillProcess ProcessName="VBCSCompiler" ImagePath="$(WebProjectOutputDir)" />
<Copy SourceFiles="@(RoslyCompilerFiles)" DestinationFolder="$(WebProjectOutputDir)\bin\roslyn" ContinueOnError="true" SkipUnchangedFiles="true" />
</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();
Log.LogMessage("ExecutablePath is {0}", (string)mo["ExecutablePath"]);
if(mo != null && string.Compare((string)mo["ExecutablePath"], ImagePath, StringComparison.OrdinalIgnoreCase) > 0)
{
p.Kill();
Log.LogMessage("{0} is killed", (string)mo["ExecutablePath"]);
break;
}
}
}
}
}
catch (Exception ex)
{
Log.LogErrorFromException(ex);
}
return true;
]]>
</Code>
</Task>
</UsingTask>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<compiler
language="c#;cs;csharp"
extension=".cs"
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.6.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
warningLevel="4"
compilerOptions="/langversion:6 /nowarn:1659;1699;1701"
xdt:Transform="Insert" />
Expand All @@ -49,7 +49,7 @@
<compiler
language="vb;vbs;visualbasic;vbscript"
extension=".vb"
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.6.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
warningLevel="4"
compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+"
xdt:Transform="Insert" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<compiler
language="c#;cs;csharp"
extension=".cs"
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.6.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
warningLevel="4"
compilerOptions="/langversion:default /nowarn:1659;1699;1701"
xdt:Transform="Insert" />
Expand All @@ -49,7 +49,7 @@
<compiler
language="vb;vbs;visualbasic;vbscript"
extension=".vb"
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.6.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
warningLevel="4"
compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+"
xdt:Transform="Insert" />
Expand Down
2 changes: 1 addition & 1 deletion tools/RoslynCodeProvider.settings.targets
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<VersionStartYear>2014</VersionStartYear>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<VersionRelease>5</VersionRelease>
<VersionRelease>6</VersionRelease>
<VersionRelease Condition="'$(BuildQuality)' != 'rtm'">$(VersionRelease)-$(BuildQuality)</VersionRelease>
</PropertyGroup>

Expand Down

0 comments on commit ccd373a

Please sign in to comment.