nugetizer icon indicating copy to clipboard operation
nugetizer copied to clipboard

F# projects are not supported

Open tastyeggs opened this issue 2 years ago • 2 comments

For the following fsproj file:

<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFrameworks>net6.0;netstandard2.0</TargetFrameworks>
    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)'=='Release'">
        <Version>1.0.0</Version>
    <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
    <IsPackable>True</IsPackable>
  </PropertyGroup>

  <ItemGroup>
    <Compile Include="File1.fs" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="NuGetizer" Version="0.8.0" />
  </ItemGroup>
</Project>

Running the following command:

PS ...\LibLangFsharp\src> dotnet build -c Release
Microsoft (R) Build Engine version 17.2.0+41abc5629 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
  All projects are up-to-date for restore.
C:\Program Files\dotnet\sdk\6.0.301\FSharp\Microsoft.FSharp.NetSdk.targets(60,77): error MSB4057: The target "_GetFrameworkAssemblyReferences" does not exist in the project. [...\LibLangFsharp\src\LibLangFsharp.fsproj]
C:\Program Files\dotnet\sdk\6.0.301\FSharp\Microsoft.FSharp.NetSdk.targets(60,77): error MSB4057: The target "_GetFrameworkAssemblyReferences" does not exist in the project. [...\LibLangFsharp\src\LibLangFsharp.fsproj]

Build FAILED.

The nugetize command however succeeds.

tastyeggs avatar Jun 15 '22 00:06 tastyeggs

I can confirm this behaviour.

7enderhead avatar Jun 17 '22 11:06 7enderhead

I've no idea why that target is being referenced, but it's part of the F# SDK: https://github.com/dotnet/fsharp/blob/main/src/FSharp.Build/Microsoft.FSharp.NetSdk.targets#L60

So, it doesn't look like it's something I can fix on my end. Not sure what would trigger that target to attempt to run when nugetizer is installed, though :(

It also looks like they have SDK Pack specific targets too (see TargetsForTfmSpecificContentInPackage in that same targets file).

I'm not familiar with F# as to know how it packs what would need changing for it to work with nugetizer, I'm afraid.

Happy to take a PR, though!

kzu avatar Jul 14 '22 22:07 kzu

Would work on this if sponsored to do so. See https://github.com/sponsors/Devlooped

Thanks.

kzu avatar Feb 04 '23 05:02 kzu