我正在使用 VS 2022,当我创建一个 F# 项目和解决方案时,在构建解决方案时,它会将所有间接引用的程序集从另一个程序集转储到 bin 目录中。
当我用C#编写相同的程序时,生成目录是干净的,只包含构建文件以及我告诉它要包含的引用程序集(使用Copy Local)。引用了所有其他程序集的程序集在两个项目中其私有属性都标记为False,但F#仍然会将所有内容拖入其中。
这只是F#如何构建和引用C#库的问题吗?
我尝试修改了 Private 属性,并寻找其他可能适用的配置项。我将要添加到目录中的 DLL 添加到项目文件中,希望它不会复制它,但它仍然会复制。
以下是 .csproj 文件。
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{B9485712-4A8F-4894-8268-003BC72149C3}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>ConnectTest</RootNamespace>
<AssemblyName>ConnectTest</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="EllieMae.Encompass.AsmResolver">
<HintPath>C:\Program Files (x86)\Encompass\EllieMae.Encompass.AsmResolver.dll</HintPath>
</Reference>
<Reference Include="EllieMae.Encompass.Runtime">
<HintPath>C:\Program Files (x86)\Encompass\EllieMae.Encompass.Runtime.dll</HintPath>
</Reference>
<Reference Include="EncompassObjects">
<HintPath>C:\Program Files (x86)\Encompass\EncompassObjects.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
这是 .fsproj 文件。
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net48</TargetFramework>
<WarnOn>3390;$(WarnOn)</WarnOn>
</PropertyGroup>
<ItemGroup>
<Compile Include="Program.fs" />
</ItemGroup>
<ItemGroup>
<Reference Include="ClientServer">
<HintPath>C:\Program Files (x86)\Encompass\ClientServer.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="EllieMae.Encompass.AsmResolver">
<HintPath>C:\Program Files (x86)\Encompass\EllieMae.Encompass.AsmResolver.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="EllieMae.Encompass.Runtime">
<HintPath>C:\Program Files (x86)\Encompass\EllieMae.Encompass.Runtime.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="EncompassObjects">
<HintPath>C:\Program Files (x86)\Encompass\EncompassObjects.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
</Project>
.csrpoj
和.fsproj
吗? - undefined