ApplicationInsights-dotnet/LOGGING/AddXmlLanguage.targets

70 строки
3.1 KiB
Plaintext
Исходник Обычный вид История

<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
Tilee/everything (#1275) * everything solution * added base and web tests * update netcore * add logging and netcore tests * update references * fxcop warnings: invariant string * add nuget config * solution update * cleanup packages.config * Remove perf\xdt.tests * fxcop * change script * update script * update script * rename project to reflect actual TargetFramework * rename projects and folders to match their build framework. this matters for pattern matching to discover tests * Change test projects from Net4.5.1 to Net4.5 * rename assembly * testing an update to the Test Adapters * update internalsvisibleto * update internalsvisibleto * update solutions with renamed projects * add Core func tests * update script * remove NetCore3.0 projects from sln * test add extra project to netcore. update script. * restore net core 3.0 projects * removing netcore 3.0 projects. Will solve later * fix for TaskFactory not compatible with NetCore * update all these other task factories * fxcop * testing netcore 3.0 projects * more fxcop * test fix for FallbackDirectory * testing removing feed * update MSTest.TestAdapter 1.4 > 2.0 update MSTest.TestFramework 1.4 > 2.0 update Microsoft.NET.Test.Sdk 16.1 > 16.2 * update test packages * roll back Microsoft.NET.Test.Sdk * change to flaky test * testing fix for linux build * testing fix for linux build. removing private feeds from nuget.config * testing fix for flaky test * test fix for linux build. specify version of nuget.exe * testing fix for linux build. Use Nuget restore instead of DotNet restore * fix quotes * fix quotes * remove commented task * yml * test fix for linux nuget * test fix for linux build. compile sln * fix for linux build * fix for file exception * cleanup * revert changes to linux build. * fix * fix * remove extra file * removing nuget dependency from WEB E2E tests: DependencyCollection * removing nuget dependency from WEB E2E tests: PerformanceCollector * missed one project * removing nuget dependency from WEB E2E tests: FunctionalTests * turn off strongname in docker tests
2019-11-08 00:22:11 +03:00
<UsingTask TaskName="InjectXmlLanguage" TaskFactory="RoslynCodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
<ParameterGroup>
<InputFiles ParameterType="Microsoft.Build.Framework.ITaskItem[]" Required="true" />
</ParameterGroup>
<Task>
Tilee/everything (#1275) * everything solution * added base and web tests * update netcore * add logging and netcore tests * update references * fxcop warnings: invariant string * add nuget config * solution update * cleanup packages.config * Remove perf\xdt.tests * fxcop * change script * update script * update script * rename project to reflect actual TargetFramework * rename projects and folders to match their build framework. this matters for pattern matching to discover tests * Change test projects from Net4.5.1 to Net4.5 * rename assembly * testing an update to the Test Adapters * update internalsvisibleto * update internalsvisibleto * update solutions with renamed projects * add Core func tests * update script * remove NetCore3.0 projects from sln * test add extra project to netcore. update script. * restore net core 3.0 projects * removing netcore 3.0 projects. Will solve later * fix for TaskFactory not compatible with NetCore * update all these other task factories * fxcop * testing netcore 3.0 projects * more fxcop * test fix for FallbackDirectory * testing removing feed * update MSTest.TestAdapter 1.4 > 2.0 update MSTest.TestFramework 1.4 > 2.0 update Microsoft.NET.Test.Sdk 16.1 > 16.2 * update test packages * roll back Microsoft.NET.Test.Sdk * change to flaky test * testing fix for linux build * testing fix for linux build. removing private feeds from nuget.config * testing fix for flaky test * test fix for linux build. specify version of nuget.exe * testing fix for linux build. Use Nuget restore instead of DotNet restore * fix quotes * fix quotes * remove commented task * yml * test fix for linux nuget * test fix for linux build. compile sln * fix for linux build * fix for file exception * cleanup * revert changes to linux build. * fix * fix * remove extra file * removing nuget dependency from WEB E2E tests: DependencyCollection * removing nuget dependency from WEB E2E tests: PerformanceCollector * missed one project * removing nuget dependency from WEB E2E tests: FunctionalTests * turn off strongname in docker tests
2019-11-08 00:22:11 +03:00
<!--<Reference Include="System" />-->
<Using Namespace="System" />
<Using Namespace="System.Diagnostics" />
<Using Namespace="System.IO" />
<Code Type="Fragment" Language="cs">
<![CDATA[
Log.LogMessage("Called InjectXmlLanguage");
foreach (var inputFilePath in InputFiles.Select(f => f.ItemSpec))
{
Log.LogMessage("Fixing {0}", inputFilePath);
string filePath = inputFilePath;
if (filePath.EndsWith(".dll", StringComparison.OrdinalIgnoreCase))
{
filePath = filePath.Substring(0, filePath.Length - 3) + "xml";
}
if (filePath.EndsWith(".xml", StringComparison.OrdinalIgnoreCase))
{
string[] files = null;
int starIndex = filePath.IndexOf('*');
if (starIndex >= 0)
{
string dir = filePath.Substring(0, starIndex);
if (string.IsNullOrEmpty(dir))
{
dir = ".";
}
string file = Path.GetFileName(filePath.Substring(starIndex));
files = Directory.GetFiles(dir, file, SearchOption.AllDirectories);
}
else
{
files = new[] { filePath };
}
foreach (string fileName in files)
{
if (File.Exists(fileName))
{
Log.LogMessage("Processing XML: {0}", fileName);
string text = File.ReadAllText(fileName);
text = text.Replace("<doc>", "<doc xml:lang=\"en\">");
File.WriteAllText(fileName, text);
}
}
}
}
]]>
</Code>
</Task>
</UsingTask>
<Target Name="FixXmlDocumentation" AfterTargets="AfterBuild" DependsOnTargets="AfterBuild">
<InjectXmlLanguage InputFiles="$(DocumentationFile)" />
</Target>
<Target Name="AddXmlDocToNugetPackage">
<ItemGroup>
<BuildOutputInPackage Include="$(OutputPath)$(TargetName).xml" />
</ItemGroup>
</Target>
</Project>