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

None Update ignored in F# projects #8914

Closed
cartermp opened this issue Apr 9, 2020 · 13 comments · Fixed by #16817
Closed

None Update ignored in F# projects #8914

cartermp opened this issue Apr 9, 2020 · 13 comments · Fixed by #16817
Assignees
Milestone

Comments

@cartermp
Copy link
Contributor

cartermp commented Apr 9, 2020

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.

@cartermp cartermp added Bug Area-ProjectsAndBuild MSBuild tasks, project files, framework resolution labels Apr 9, 2020
@cartermp cartermp added this to the Backlog milestone Apr 9, 2020
@cartermp
Copy link
Contributor Author

cartermp commented Apr 9, 2020

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

@abelbraaksma
Copy link
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.

@0x53A
Copy link
Contributor

0x53A commented Apr 9, 2020

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.

@abelbraaksma
Copy link
Contributor

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

@pihai
Copy link

pihai commented May 6, 2020

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

@aaronpowell
Copy link

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

@vjraitila
Copy link

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.

@cartermp
Copy link
Contributor Author

cartermp commented Aug 3, 2020

@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.

@KevinRansom
Copy link
Member

I will take a look.

@KevinRansom KevinRansom self-assigned this Aug 3, 2020
@dsyme dsyme added the Impact-Medium (Internal MS Team use only) Describes an issue with moderate impact on existing code. label Sep 1, 2020
@Kurren123
Copy link

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.

@cartermp cartermp modified the milestones: Backlog, 16.9 Nov 25, 2020
@cartermp cartermp modified the milestones: 16.9, 16.10 Jan 6, 2021
@cartermp cartermp modified the milestones: 16.10, Backlog Apr 13, 2021
@davkean
Copy link
Member

davkean commented May 7, 2021

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

@KevinRansom
Copy link
Member

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

@KevinRansom
Copy link
Member

KevinRansom commented Mar 26, 2024

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.

@KevinRansom KevinRansom added Resolution-Wont Fix and removed Bug Impact-Medium (Internal MS Team use only) Describes an issue with moderate impact on existing code. Area-ProjectsAndBuild MSBuild tasks, project files, framework resolution labels Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

10 participants