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

ItemGroup None Update ignored in fsharp project msbuild #1177

Closed
richardjharding opened this issue Apr 1, 2019 · 3 comments
Closed

ItemGroup None Update ignored in fsharp project msbuild #1177

richardjharding opened this issue Apr 1, 2019 · 3 comments

Comments

@richardjharding
Copy link

I'm not sure this is the correct repo so please point me in direction of correct repo if this is wrong the place to raise

I noticed an issue when attempting to build a functions v2 project with fsharp - I compared with an equivalent c# project and noticed a discrepancy. The issue is the behaviour of copying additional files such as host.json

with these lines

 <ItemGroup>
    <None Update="host.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <None Update="local.settings.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <CopyToPublishDirectory>Never</CopyToPublishDirectory>
    </None>
  </ItemGroup>

when I build the csharp project with dotnet build the 2 json files are copied as expected (whether they already exists or not in output folder) but when I execute the same build with fsharp project no files are copied

When I examined the build log with msbuild structured log viewer in the c# example the None item group was present but in the f# log it was not

When I change the f# example project to use Include rather than Update eg

<ItemGroup>
    <None Include="host.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <None Include="local.settings.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <CopyToPublishDirectory>Never</CopyToPublishDirectory>
    </None>
  </ItemGroup> 

it works as expected - this is with

.net sdk 2.2.105
in both cases
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.26" />
and

Azure Functions Core Tools (2.4.498 Commit hash: 47cc64bd19eb8fa9bcbb1aaac88b217a9558617b)
Function Runtime Version: 2.0.12353.0
@estensen
Copy link

estensen commented Mar 3, 2020

This is still an issue! I spent quite a long time banding my head against the wall because the Cosmos bindings would not work. The F# template should generate correct config!

@Youenn-Bouglouan
Copy link

I experienced this issue as well today, took me 2 hours to figure out what was going on. I initially thought it was related to the Azure Functions template as well, but it can be reproduced with a very simple .NET Core 3.1 console app (<None Update="host.json"> works with csproj but not with fsproj).

Ideally there shouldn't be any difference at all between languages when it comes to those msbuild settings. @cartermp are you aware of this issue? Is there a better repo to submit this problem to?

Thanks!

@cartermp
Copy link
Contributor

cartermp commented Apr 9, 2020

Yeah, this isn't specific to F# or even visual studio tooling. I think there might be something wrong in the F# targets. I'll close this as a duplicate: dotnet/fsharp#8914

@cartermp cartermp closed this as completed Apr 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants