Skip to content

Commit

Permalink
Move warning into a target to fix msbuild error (#1856)
Browse files Browse the repository at this point in the history
Fixes msbuild error "The <Warning> tag is no longer supported as a
child of the <Project> element".
  • Loading branch information
ViktorHofer authored and singhsarab committed Dec 4, 2018
1 parent c8e01c2 commit 069c5f8
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions src/package/nuspec/netcoreapp/Microsoft.NET.Test.Sdk.targets
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
***********************************************************************************************
-->

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project InitialTargets="GenerateProgramFile" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
Expand All @@ -24,26 +24,31 @@
<OutputType>Exe</OutputType>
</PropertyGroup>

<!--
============================================================
GenerateProgramFile
Generates Program file which contains the Main entry point
============================================================
-->
<PropertyGroup>
<GeneratedProgramFile Condition="'$(GeneratedProgramFile)' == ''">$(MSBuildThisFileDirectory)Microsoft.NET.Test.Sdk.Program$(DefaultLanguageSourceExtension)</GeneratedProgramFile>
<GenerateProgramFile Condition="'$(GenerateProgramFile)' == ''">true</GenerateProgramFile>
</PropertyGroup>

<ItemGroup Condition="('$(GenerateProgramFile)' == 'true') and ('$(Language)' == 'VB' or '$(Language)' == 'C#')">
<Compile Include="$(GeneratedProgramFile)"/>
</ItemGroup>
<!--
============================================================
GenerateProgramFile
Generates Program file which contains the Main entry point
============================================================
-->
<Target Name="GenerateProgramFile"
Condition="'$(GenerateProgramFile)' == 'true'">

<ItemGroup Condition="'$(Language)' == 'VB' or '$(Language)' == 'C#'">
<Compile Include="$(GeneratedProgramFile)"/>
</ItemGroup>

<ItemGroup Condition="'$(Language)' == 'F#'">
<ProgramCompiles Include="@(Compile)" Condition="'%(Identity)' == 'Program.fs'" />
<CompileAfter Include="$(GeneratedProgramFile)" Condition="@(ProgramCompiles-&gt;Count()) == 0" />
</ItemGroup>

<ItemGroup Condition="'$(GenerateProgramFile)' == 'true' and '$(Language)' == 'F#'">
<ProgramCompiles Include="@(Compile)" Condition="'%(Identity)' == 'Program.fs'" />
<CompileAfter Include="$(GeneratedProgramFile)" Condition="@(ProgramCompiles-&gt;Count()) == 0" />
</ItemGroup>
<Warning Condition="@(ProgramCompiles-&gt;Count()) != 0" Text="A 'Program.fs' file can be automatically generated for F# .NET Core test projects. To fix this warning, either delete the file from the project, or set the &lt;GenerateProgramFile&gt; property to 'false'." />

<Warning Condition="@(ProgramCompiles-&gt;Count()) != 0" Text="A 'Program.fs' file can be automatically generated for F# .NET Core test projects. To fix this warning, either delete the file from the project, or set the &lt;GenerateProgramFile&gt; property to 'false'." />
</Target>

</Project>

0 comments on commit 069c5f8

Please sign in to comment.