Merge pull request #9798 from nguerrera/fix-build-warning2
Fix build warnings and treat msbuild warnings as errors
This commit is contained in:
commit
1cfc1941de
6 changed files with 54 additions and 18 deletions
|
@ -1,8 +1,9 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project>
|
||||
|
||||
<!-- This test asset needs to import the general dir.props in order to get the SdkNugetVersion property.
|
||||
This is why it also needs to explicitly set DisableImplicitFrameworkReferences to false. -->
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
<Import Sdk="Microsoft.NET.Sdk" Project="Sdk.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<VersionPrefix>1.0.0-rc</VersionPrefix>
|
||||
|
@ -23,4 +24,5 @@
|
|||
<PackageReference Include="System.Linq" Version="4.3.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<Import Sdk="Microsoft.NET.Sdk" Project="Sdk.targets" />
|
||||
</Project>
|
||||
|
|
|
@ -33,5 +33,6 @@
|
|||
<NoWarn>NU1701;NU5104</NoWarn>
|
||||
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<MSBuildTreatWarningsAsErrors>true</MSBuildTreatWarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
|
|
@ -78,7 +78,7 @@
|
|||
<PropertyGroup>
|
||||
<BuildTasksFeedToolVersion>2.1.0-prerelease-02430-04</BuildTasksFeedToolVersion>
|
||||
<VersionToolsVersion>$(BuildTasksFeedToolVersion)</VersionToolsVersion>
|
||||
<DotnetDebToolVersion>2.0.0-preview2-25331-01</DotnetDebToolVersion>
|
||||
<DotnetDebToolVersion>2.0.0</DotnetDebToolVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -94,12 +94,12 @@
|
|||
UseHardlinksIfPossible="False" />
|
||||
|
||||
<!-- Remove Shared Framework and Debian Packages -->
|
||||
<Exec Command="sudo dpkg -r $(SdkDebianPackageName)" />
|
||||
<Exec Command="sudo dpkg -r $(AspNetCoreSharedFxDebianPackageName)" />
|
||||
<Exec Command="sudo dpkg -r $(SharedFxDebianPackageName)" />
|
||||
<Exec Command="sudo dpkg -r $(HostFxrDebianPackageName)" />
|
||||
<Exec Command="sudo dpkg -r $(HostDebianPackageName)" />
|
||||
<Exec Command="sudo dpkg -r $(RuntimeDepsPackageName)" />
|
||||
<Exec Command="sudo dpkg -r $(SdkDebianPackageName)" IgnoreStandardErrorWarningFormat="true" />
|
||||
<Exec Command="sudo dpkg -r $(AspNetCoreSharedFxDebianPackageName)" IgnoreStandardErrorWarningFormat="true" />
|
||||
<Exec Command="sudo dpkg -r $(SharedFxDebianPackageName)" IgnoreStandardErrorWarningFormat="true" />
|
||||
<Exec Command="sudo dpkg -r $(HostFxrDebianPackageName)" IgnoreStandardErrorWarningFormat="true" />
|
||||
<Exec Command="sudo dpkg -r $(HostDebianPackageName)" IgnoreStandardErrorWarningFormat="true"/>
|
||||
<Exec Command="sudo dpkg -r $(RuntimeDepsPackageName)" IgnoreStandardErrorWarningFormat="true" />
|
||||
</Target>
|
||||
|
||||
<Target Name="TestSdkDeb"
|
||||
|
@ -129,12 +129,12 @@
|
|||
ToolPath="$(DebianInstalledDirectory)" />
|
||||
|
||||
<!-- Clean up Packages -->
|
||||
<Exec Command="sudo dpkg -r $(SdkDebianPackageName)" />
|
||||
<Exec Command="sudo dpkg -r $(AspNetCoreSharedFxDebianPackageName)" />
|
||||
<Exec Command="sudo dpkg -r $(SharedFxDebianPackageName)" />
|
||||
<Exec Command="sudo dpkg -r $(HostFxrDebianPackageName)" />
|
||||
<Exec Command="sudo dpkg -r $(HostDebianPackageName)" />
|
||||
<Exec Command="sudo dpkg -r $(RuntimeDepsPackageName)" />
|
||||
<Exec Command="sudo dpkg -r $(SdkDebianPackageName)" IgnoreStandardErrorWarningFormat="true" />
|
||||
<Exec Command="sudo dpkg -r $(AspNetCoreSharedFxDebianPackageName)" IgnoreStandardErrorWarningFormat="true" />
|
||||
<Exec Command="sudo dpkg -r $(SharedFxDebianPackageName)" IgnoreStandardErrorWarningFormat="true" />
|
||||
<Exec Command="sudo dpkg -r $(HostFxrDebianPackageName)" IgnoreStandardErrorWarningFormat="true" />
|
||||
<Exec Command="sudo dpkg -r $(HostDebianPackageName)" IgnoreStandardErrorWarningFormat="true" />
|
||||
<Exec Command="sudo dpkg -r $(RuntimeDepsPackageName)" IgnoreStandardErrorWarningFormat="true" />
|
||||
</Target>
|
||||
|
||||
<Target Name="PrepareDotnetDebDirectories">
|
||||
|
@ -174,8 +174,9 @@
|
|||
<Target Name="TestDebuild">
|
||||
<Message Text="Don't remove this" />
|
||||
|
||||
<!-- run Debuild -->
|
||||
<Exec Command="/usr/bin/env debuild -h" ContinueOnError="true">
|
||||
<!-- run Debuild -->
|
||||
<!-- NB: IgnoreExitCode prevents Exec from failing, but does not prevent us from retrieving the exit code. -->
|
||||
<Exec Command="/usr/bin/env debuild -h > /dev/null 2>&1" IgnoreExitCode="true">
|
||||
<Output TaskParameter="ExitCode" PropertyName="DebuildExitCode" />
|
||||
</Exec>
|
||||
|
||||
|
|
|
@ -196,7 +196,8 @@
|
|||
<Target Name="TestFPMTool">
|
||||
|
||||
<!-- run FPM -->
|
||||
<Exec Command="fpm --help > /dev/null" ContinueOnError="True">
|
||||
<!-- NB: IgnoreExitCode prevents Exec from failing, but does not prevent us from retrieving the exit code. -->
|
||||
<Exec Command="fpm --help > /dev/null 2>&1" IgnoreExitCode="True">
|
||||
<Output TaskParameter="ExitCode" PropertyName="FPMExitCode"/>
|
||||
</Exec>
|
||||
|
||||
|
|
|
@ -82,7 +82,38 @@ namespace Microsoft.DotNet.Build.Tasks
|
|||
|
||||
protected override MessageImportance StandardOutputLoggingImportance
|
||||
{
|
||||
get { return MessageImportance.High; } // or else the output doesn't get logged by default
|
||||
// Default is low, but we want to see output at normal verbosity.
|
||||
get { return MessageImportance.Normal; }
|
||||
}
|
||||
|
||||
protected override MessageImportance StandardErrorLoggingImportance
|
||||
{
|
||||
// This turns stderr messages into msbuild errors below.
|
||||
get { return MessageImportance.High; }
|
||||
}
|
||||
|
||||
protected override void LogEventsFromTextOutput(string singleLine, MessageImportance messageImportance)
|
||||
{
|
||||
// Crossgen's error/warning formatting is inconsistent and so we do
|
||||
// not use the "canonical error format" handling of base.
|
||||
//
|
||||
// Furthermore, we don't want to log crossgen warnings as msbuild
|
||||
// warnings because we cannot prevent them and they are only
|
||||
// occasionally formatted as something that base would recognize as
|
||||
// a canonically formatted warning anyway.
|
||||
//
|
||||
// One thing that is consistent is that crossgne errors go to stderr
|
||||
// and everything else goes to stdout. Above, we set stderr to high
|
||||
// importance above, and stdout to normal. So we can use that here
|
||||
// to distinguish between errors and messages.
|
||||
if (messageImportance == MessageImportance.High)
|
||||
{
|
||||
Log.LogError(singleLine);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.LogMessage(messageImportance, singleLine);
|
||||
}
|
||||
}
|
||||
|
||||
protected override string GenerateFullPathToTool()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue