Skip to content

Commit

Permalink
Add NETSdkWarning task
Browse files Browse the repository at this point in the history
  • Loading branch information
Nate McMaster committed Mar 19, 2018
1 parent 8b922d3 commit 77b1f7c
Show file tree
Hide file tree
Showing 19 changed files with 124 additions and 29 deletions.
25 changes: 25 additions & 0 deletions src/Tasks/Common/NETSdkWarning.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace Microsoft.NET.Build.Tasks
{
/// <summary>
/// Provides a localizable mechanism for logging a warning from the SDK targets.
/// </summary>
public class
#if EXTENSIONS
// This task source is shared with multiple task Dlls. Since both tasks
// may be loaded into the same project and each task accesses only resources
// in its own assembly they must have a unique name so-as not to clash.
NETBuildExtensionsWarning
#else
NETSdkWarning
#endif
: MessageBase
{
protected override void LogMessage(string message)
{
Log.LogWarning(message);
}
}
}
5 changes: 4 additions & 1 deletion src/Tasks/Common/Resources/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -334,4 +334,7 @@
<value>Invalid value for ItemSpecToUse parameter: '{0}'. This property must be blank or set to 'Left' or 'Right'</value>
<comment>The following are names of parameters or literal values and should not be translated: ItemSpecToUse, Left, Right</comment>
</data>
</root>
<data name="ProjectContainsObsoleteDotNetCliTool" xml:space="preserve">
<value>Using DotNetCliToolReference to reference '{0}' is obsolete and can be removed from this project. This tool is bundled by default in the .NET Core SDK.</value>
</data>
</root>
5 changes: 5 additions & 0 deletions src/Tasks/Common/Resources/xlf/Strings.cs.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,11 @@
<target state="new">Invalid value for ItemSpecToUse parameter: '{0}'. This property must be blank or set to 'Left' or 'Right'</target>
<note>The following are names of parameters or literal values and should not be translated: ItemSpecToUse, Left, Right</note>
</trans-unit>
<trans-unit id="ProjectContainsObsoleteDotNetCliTool">
<source>Using DotNetCliToolReference to reference '{0}' is obsolete and can be removed from this project. This tool is bundled by default in the .NET Core SDK.</source>
<target state="new">Using DotNetCliToolReference to reference '{0}' is obsolete and can be removed from this project. This tool is bundled by default in the .NET Core SDK.</target>
<note />
</trans-unit>
</body>
</file>
</xliff>
5 changes: 5 additions & 0 deletions src/Tasks/Common/Resources/xlf/Strings.de.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,11 @@
<target state="new">Invalid value for ItemSpecToUse parameter: '{0}'. This property must be blank or set to 'Left' or 'Right'</target>
<note>The following are names of parameters or literal values and should not be translated: ItemSpecToUse, Left, Right</note>
</trans-unit>
<trans-unit id="ProjectContainsObsoleteDotNetCliTool">
<source>Using DotNetCliToolReference to reference '{0}' is obsolete and can be removed from this project. This tool is bundled by default in the .NET Core SDK.</source>
<target state="new">Using DotNetCliToolReference to reference '{0}' is obsolete and can be removed from this project. This tool is bundled by default in the .NET Core SDK.</target>
<note />
</trans-unit>
</body>
</file>
</xliff>
5 changes: 5 additions & 0 deletions src/Tasks/Common/Resources/xlf/Strings.es.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,11 @@
<target state="new">Invalid value for ItemSpecToUse parameter: '{0}'. This property must be blank or set to 'Left' or 'Right'</target>
<note>The following are names of parameters or literal values and should not be translated: ItemSpecToUse, Left, Right</note>
</trans-unit>
<trans-unit id="ProjectContainsObsoleteDotNetCliTool">
<source>Using DotNetCliToolReference to reference '{0}' is obsolete and can be removed from this project. This tool is bundled by default in the .NET Core SDK.</source>
<target state="new">Using DotNetCliToolReference to reference '{0}' is obsolete and can be removed from this project. This tool is bundled by default in the .NET Core SDK.</target>
<note />
</trans-unit>
</body>
</file>
</xliff>
5 changes: 5 additions & 0 deletions src/Tasks/Common/Resources/xlf/Strings.fr.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,11 @@
<target state="new">Invalid value for ItemSpecToUse parameter: '{0}'. This property must be blank or set to 'Left' or 'Right'</target>
<note>The following are names of parameters or literal values and should not be translated: ItemSpecToUse, Left, Right</note>
</trans-unit>
<trans-unit id="ProjectContainsObsoleteDotNetCliTool">
<source>Using DotNetCliToolReference to reference '{0}' is obsolete and can be removed from this project. This tool is bundled by default in the .NET Core SDK.</source>
<target state="new">Using DotNetCliToolReference to reference '{0}' is obsolete and can be removed from this project. This tool is bundled by default in the .NET Core SDK.</target>
<note />
</trans-unit>
</body>
</file>
</xliff>
5 changes: 5 additions & 0 deletions src/Tasks/Common/Resources/xlf/Strings.it.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,11 @@
<target state="new">Invalid value for ItemSpecToUse parameter: '{0}'. This property must be blank or set to 'Left' or 'Right'</target>
<note>The following are names of parameters or literal values and should not be translated: ItemSpecToUse, Left, Right</note>
</trans-unit>
<trans-unit id="ProjectContainsObsoleteDotNetCliTool">
<source>Using DotNetCliToolReference to reference '{0}' is obsolete and can be removed from this project. This tool is bundled by default in the .NET Core SDK.</source>
<target state="new">Using DotNetCliToolReference to reference '{0}' is obsolete and can be removed from this project. This tool is bundled by default in the .NET Core SDK.</target>
<note />
</trans-unit>
</body>
</file>
</xliff>
5 changes: 5 additions & 0 deletions src/Tasks/Common/Resources/xlf/Strings.ja.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,11 @@
<target state="new">Invalid value for ItemSpecToUse parameter: '{0}'. This property must be blank or set to 'Left' or 'Right'</target>
<note>The following are names of parameters or literal values and should not be translated: ItemSpecToUse, Left, Right</note>
</trans-unit>
<trans-unit id="ProjectContainsObsoleteDotNetCliTool">
<source>Using DotNetCliToolReference to reference '{0}' is obsolete and can be removed from this project. This tool is bundled by default in the .NET Core SDK.</source>
<target state="new">Using DotNetCliToolReference to reference '{0}' is obsolete and can be removed from this project. This tool is bundled by default in the .NET Core SDK.</target>
<note />
</trans-unit>
</body>
</file>
</xliff>
5 changes: 5 additions & 0 deletions src/Tasks/Common/Resources/xlf/Strings.ko.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,11 @@
<target state="new">Invalid value for ItemSpecToUse parameter: '{0}'. This property must be blank or set to 'Left' or 'Right'</target>
<note>The following are names of parameters or literal values and should not be translated: ItemSpecToUse, Left, Right</note>
</trans-unit>
<trans-unit id="ProjectContainsObsoleteDotNetCliTool">
<source>Using DotNetCliToolReference to reference '{0}' is obsolete and can be removed from this project. This tool is bundled by default in the .NET Core SDK.</source>
<target state="new">Using DotNetCliToolReference to reference '{0}' is obsolete and can be removed from this project. This tool is bundled by default in the .NET Core SDK.</target>
<note />
</trans-unit>
</body>
</file>
</xliff>
5 changes: 5 additions & 0 deletions src/Tasks/Common/Resources/xlf/Strings.pl.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,11 @@
<target state="new">Invalid value for ItemSpecToUse parameter: '{0}'. This property must be blank or set to 'Left' or 'Right'</target>
<note>The following are names of parameters or literal values and should not be translated: ItemSpecToUse, Left, Right</note>
</trans-unit>
<trans-unit id="ProjectContainsObsoleteDotNetCliTool">
<source>Using DotNetCliToolReference to reference '{0}' is obsolete and can be removed from this project. This tool is bundled by default in the .NET Core SDK.</source>
<target state="new">Using DotNetCliToolReference to reference '{0}' is obsolete and can be removed from this project. This tool is bundled by default in the .NET Core SDK.</target>
<note />
</trans-unit>
</body>
</file>
</xliff>
5 changes: 5 additions & 0 deletions src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,11 @@
<target state="new">Invalid value for ItemSpecToUse parameter: '{0}'. This property must be blank or set to 'Left' or 'Right'</target>
<note>The following are names of parameters or literal values and should not be translated: ItemSpecToUse, Left, Right</note>
</trans-unit>
<trans-unit id="ProjectContainsObsoleteDotNetCliTool">
<source>Using DotNetCliToolReference to reference '{0}' is obsolete and can be removed from this project. This tool is bundled by default in the .NET Core SDK.</source>
<target state="new">Using DotNetCliToolReference to reference '{0}' is obsolete and can be removed from this project. This tool is bundled by default in the .NET Core SDK.</target>
<note />
</trans-unit>
</body>
</file>
</xliff>
5 changes: 5 additions & 0 deletions src/Tasks/Common/Resources/xlf/Strings.ru.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,11 @@
<target state="new">Invalid value for ItemSpecToUse parameter: '{0}'. This property must be blank or set to 'Left' or 'Right'</target>
<note>The following are names of parameters or literal values and should not be translated: ItemSpecToUse, Left, Right</note>
</trans-unit>
<trans-unit id="ProjectContainsObsoleteDotNetCliTool">
<source>Using DotNetCliToolReference to reference '{0}' is obsolete and can be removed from this project. This tool is bundled by default in the .NET Core SDK.</source>
<target state="new">Using DotNetCliToolReference to reference '{0}' is obsolete and can be removed from this project. This tool is bundled by default in the .NET Core SDK.</target>
<note />
</trans-unit>
</body>
</file>
</xliff>
5 changes: 5 additions & 0 deletions src/Tasks/Common/Resources/xlf/Strings.tr.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,11 @@
<target state="new">Invalid value for ItemSpecToUse parameter: '{0}'. This property must be blank or set to 'Left' or 'Right'</target>
<note>The following are names of parameters or literal values and should not be translated: ItemSpecToUse, Left, Right</note>
</trans-unit>
<trans-unit id="ProjectContainsObsoleteDotNetCliTool">
<source>Using DotNetCliToolReference to reference '{0}' is obsolete and can be removed from this project. This tool is bundled by default in the .NET Core SDK.</source>
<target state="new">Using DotNetCliToolReference to reference '{0}' is obsolete and can be removed from this project. This tool is bundled by default in the .NET Core SDK.</target>
<note />
</trans-unit>
</body>
</file>
</xliff>
5 changes: 5 additions & 0 deletions src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,11 @@
<target state="new">Invalid value for ItemSpecToUse parameter: '{0}'. This property must be blank or set to 'Left' or 'Right'</target>
<note>The following are names of parameters or literal values and should not be translated: ItemSpecToUse, Left, Right</note>
</trans-unit>
<trans-unit id="ProjectContainsObsoleteDotNetCliTool">
<source>Using DotNetCliToolReference to reference '{0}' is obsolete and can be removed from this project. This tool is bundled by default in the .NET Core SDK.</source>
<target state="new">Using DotNetCliToolReference to reference '{0}' is obsolete and can be removed from this project. This tool is bundled by default in the .NET Core SDK.</target>
<note />
</trans-unit>
</body>
</file>
</xliff>
5 changes: 5 additions & 0 deletions src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,11 @@
<target state="new">Invalid value for ItemSpecToUse parameter: '{0}'. This property must be blank or set to 'Left' or 'Right'</target>
<note>The following are names of parameters or literal values and should not be translated: ItemSpecToUse, Left, Right</note>
</trans-unit>
<trans-unit id="ProjectContainsObsoleteDotNetCliTool">
<source>Using DotNetCliToolReference to reference '{0}' is obsolete and can be removed from this project. This tool is bundled by default in the .NET Core SDK.</source>
<target state="new">Using DotNetCliToolReference to reference '{0}' is obsolete and can be removed from this project. This tool is bundled by default in the .NET Core SDK.</target>
<note />
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and
created a backup copy. Incorrect changes to this file will make it
impossible to load or build your projects from the command-line or the IDE.
Copyright (c) .NET Foundation. All rights reserved.
Copyright (c) .NET Foundation. All rights reserved.
***********************************************************************************************
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
Expand All @@ -20,6 +20,7 @@ Copyright (c) .NET Foundation. All rights reserved.

<UsingTask TaskName="GetDependsOnNETStandard" AssemblyFile="$(MicrosoftNETBuildExtensionsTasksAssembly)" />
<UsingTask TaskName="NETBuildExtensionsError" AssemblyFile="$(MicrosoftNETBuildExtensionsTasksAssembly)" />
<UsingTask TaskName="NETBuildExtensionsWarning" AssemblyFile="$(MicrosoftNETBuildExtensionsTasksAssembly)" />

<Target Name="ImplicitlyExpandNETStandardFacades"
Condition="'$(ImplicitlyExpandNETStandardFacades)' == 'true'"
Expand All @@ -39,7 +40,7 @@ Copyright (c) .NET Foundation. All rights reserved.

<!-- Check metadata of _ResolvedProjectReferencePaths items. This handles the case where we are doing a design-time build and a referenced project
hasn't been built yet, so there is no corresponding assembly on disk for the GetDependsOnNETStandard task to examine.
More context: https://github.com/dotnet/sdk/issues/1403
-->
<PropertyGroup Condition="'$(DependsOnNETStandard)' == '' AND '$(NETStandardInbox)' != 'true'">
Expand All @@ -53,7 +54,7 @@ Copyright (c) .NET Foundation. All rights reserved.
<!-- 2. The target framework is .NET 4.7.1, which needs to special case some shims -->
<_RunGetDependsOnNETStandard Condition="'$(DependsOnNETStandard)' == '' AND '$(_TargetFrameworkVersionWithoutV)' == '4.7.1'">true</_RunGetDependsOnNETStandard>
</PropertyGroup>

<GetDependsOnNETStandard Condition="'$(_RunGetDependsOnNETStandard)' == 'true'"
References="@(_CandidateNETStandardReferences)">
<Output TaskParameter="DependsOnNETStandard" PropertyName="DependsOnNETStandard" />
Expand All @@ -77,13 +78,13 @@ Copyright (c) .NET Foundation. All rights reserved.
<!--
.NET 4.7.1 has support for .NET Standard 2.0 built-in, so most of the facades aren't necessary. However, the assembly versions of a few set of assemblies
do not yet match the ones shipped in the support package for .NET Standard 2.0 on .NET 4.7 and below. This means that .NET 4.7 or lower libraries might have
references to higher versions of these assemblies than are available in-box in .NET 4.7, leading to assembly loading errors. So if there is a dependency on
references to higher versions of these assemblies than are available in-box in .NET 4.7, leading to assembly loading errors. So if there is a dependency on
netstandard.dll, we include DLLs for .NET 4.7.1 from the support package to avoid these errors.
-->
<ItemGroup Condition="'$(_TargetFrameworkVersionWithoutV)' == '4.7.1'">
<_NETStandardLibraryNETFrameworkLib Include="$(MSBuildThisFileDirectory)\net471\lib\*.dll" Condition="'$(DependsOnNETStandard)' == 'true'"/>
</ItemGroup>

<!-- if any reference depends on netstandard and it is not inbox, add references and implementation assemblies for netstandard2.0 -->
<ItemGroup Condition="'$(DependsOnNETStandard)' == 'true' AND '$(NETStandardInbox)' != 'true' AND '$(_TargetFrameworkVersionWithoutV)' &lt; '4.7.1'">
<_NETStandardLibraryNETFrameworkLib Condition="'$(_TargetFrameworkVersionWithoutV)' &gt;= '4.7'"
Expand All @@ -98,7 +99,7 @@ Copyright (c) .NET Foundation. All rights reserved.

<ItemGroup Condition="'@(_NETStandardLibraryNETFrameworkLib)' != ''">
<!-- Remove simple name references if we're directly providing a reference assembly to the compiler. For example,
consider a project with a Reference Include="System.Net.Http" or "System.IO.Compression", which are both in
consider a project with a Reference Include="System.Net.Http" or "System.IO.Compression", which are both in
_NETStandardLibraryNETFrameworkReference.
Simple references can also come from NuGet framework assemblies, hence this statement should occur after
including all computed references, thus this target is scheduled after references have been raised by NuGet
Expand All @@ -109,22 +110,22 @@ Copyright (c) .NET Foundation. All rights reserved.
copied locally, and ReferenceCopyLocalPaths, which will be copied locally. The reason for this split is to
workaround https://github.com/dotnet/core-setup/issues/2981 by ensuring that the facades are written
to the deps.json with a type of "referenceassembly" instead of "reference".
The exception is netfx.force.conflicts.dll, which shouldn't be copied local. So it isn't included in
ReferenceCopyLocalPaths.
When we add the Reference items, we use the simple name as the ItemSpec, and refer to the full path
to the DLL via the HintPath metadata. This is so that if we're replacing a simple Reference,
the OriginalItemSpec of the resolved reference will match to the Reference that was replaced,
and VS won't show a warning icon on the reference. See https://github.com/dotnet/sdk/issues/1499
-->

<Reference Include="%(_NETStandardLibraryNETFrameworkLib.FileName)">
<HintPath>%(_NETStandardLibraryNETFrameworkLib.Identity)</HintPath>
<Private>false</Private>
<ExternallyResolved>$(MarkNETFrameworkExtensionAssembliesAsExternallyResolved)</ExternallyResolved>
</Reference>

<ReferenceCopyLocalPaths Include="@(_NETStandardLibraryNETFrameworkLib)" Condition="'%(FileName)' != 'netfx.force.conflicts'">
<Private>false</Private>
</ReferenceCopyLocalPaths>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ Copyright (c) .NET Foundation. All rights reserved.
<_ReferenceToObsoleteDotNetCliTool Remove="@(DotNetCliToolReference)" />
</ItemGroup>

<Target Name="_WarnAboutObsoleteDotNetCliToolReferences"
<Target Name="_CheckForObsoleteDotNetCliToolReferences"
BeforeTargets="CollectPackageReferences"
Condition=" '$(SuppressObsoleteDotNetCliToolWarning)' != 'true' ">
<Warning Code="DOTNET1018"
Text="Using DotNetCliToolReference to reference '%(_ReferenceToObsoleteDotNetCliTool.Identity)' is obsolete and can be removed from this project. This tool is bundled by default in the .NET Core SDK."
Condition=" '%(_ReferenceToObsoleteDotNetCliTool.Identity)' != '' " />
<NETSdkWarning Condition=" '%(_ReferenceToObsoleteDotNetCliTool.Identity)' != '' "
ResourceName="ProjectContainsObsoleteDotNetCliTool"
FormatArguments="%(_ReferenceToObsoleteDotNetCliTool.Identity)" />
</Target>

</Project>
Loading

0 comments on commit 77b1f7c

Please sign in to comment.