Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move warning into a target to fix msbuild error #1856

Merged
merged 1 commit into from
Dec 4, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>