Skip to content

None Update ignored in F# projects #8914

Description

@cartermp

Create a console app similar to this:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp3.1</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <None Update="test.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <Compile Include="Program.fs" />
  </ItemGroup>

</Project>

then build it.

Note that under the bin folder, test.json is not included. In a C# project, it is included. This doesn't require VS to reproduce, so it's likely us.

Activity

  1. added this to the Backlog milestone on Apr 9, 2020
  2. cartermp commented on Apr 9, 2020

    @cartermp
    ContributorAuthor

    This results in some problems when using Azure stuff like Functions: Azure/Azure-Functions#1177

  3. abelbraaksma commented on Apr 9, 2020

    @abelbraaksma
    Contributor

    I've a bunch of these in my projects, I use it for test data files for instance, but AFAIK, they still work (my VS is one or two months behind), so this may be a recent regression.

  4. 0x53A commented on Apr 9, 2020

    @0x53A
    Contributor

    I think F# does not have the default includes, so you need <None Include=. Update only works if the thing is already included, otherwise it's a no op.

    C# does includes all files in the project folder, so you can update them.

  5. abelbraaksma commented on Apr 10, 2020

    @abelbraaksma
    Contributor

    You're right, I have None Include. My bad.

  6. pihai commented on May 6, 2020

    @pihai

    Is there any chance that F# gets default includes for this? If not then the Azure Functions Project template should simply be changed to use <None Include=>.

    Azure Functions Project Template

  7. aaronpowell commented on Jun 9, 2020

    @aaronpowell

    @pihai - I've opened a PR today for this: Azure/azure-functions-templates#954

  8. vjraitila commented on Jul 15, 2020

    @vjraitila

    Is having explicit includes for individual files really the best approach? This causes a problem for files where the need to include them is situational e.g. local.settings.json for Azure Functions - you want it during local development, but said file is not available during a CI build, for example.

    To me there seems to be two conflicting goals of both keeping the project definition terse - hence the default includes - as well as wanting to be explicit. While far from being an expert on this matter, I sort of understand the compilation order aspect when it comes to F# (source files), but I'm not entirely convinced the same principle should be applied to other project artifacts as well.

  9. cartermp commented on Aug 3, 2020

    @cartermp
    ContributorAuthor

    @KevinRansom any thoughts on this? It's definitely in our camp since this can reproduce outside of VS. It means that F#-defined azure functions bundle up files that shouldn't be required for a deployment.

  10. KevinRansom commented on Aug 3, 2020

    @KevinRansom
    Contributor

    I will take a look.

  11. self-assigned this
    on Aug 3, 2020
  12. added
    Impact-Medium(Internal MS Team use only) Describes an issue with moderate impact on existing code.
    on Sep 1, 2020
  13. Kurren123 commented on Nov 25, 2020

    @Kurren123

    Just had this issue in an azure functions app template. Would be great if <None Include= did the same thing in a .fsproj as a .csproj.

  14. 4 remaining items

  15. modified the milestones: 16.10, Backlog on Apr 13, 2021
  16. davkean commented on May 7, 2021

    @davkean
    Member

    @cartermp Why doesn't F# SDK glob None/Content? Only Compile items should need to be specified explicitly.

  17. KevinRansom commented on May 7, 2021

    @KevinRansom
    Contributor

    @davkean -- it has been pointed out recently. I imagine we will address this, when we get some bandwidth.

  18. modified the milestones: Backlog, March-2024 on Mar 6, 2024
  19. KevinRansom commented on Mar 26, 2024

    @KevinRansom
    Contributor

    Now we know why we don't glob None and Content. Gloobbing impacts the order that the project system finds folders, which impacts the file ordering displayed in the solution explorer. Also it changes the display of .fsi files in solution explorer.

  20. added and removed
    Impact-Medium(Internal MS Team use only) Describes an issue with moderate impact on existing code.
    Area-ProjectsAndBuildMSBuild tasks, project files, framework resolution
    on Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions