gpt4 book ai didi

csproj - ReferencePath 与新的.NET SDK?

转载 作者:行者123 更新时间:2023-12-05 05:14:29 31 4
gpt4 key购买 nike

我正在尝试在我的 .csproj 文件中指定使用新格式的自定义 ReferencePath

这是它的样子:

<PropertyGroup>
<ReferencePath>C:\...\binaries</ReferencePath>
</PropertyGroup>

引用如下:

<Reference Include="MyDll">
<Private>false</Private>
<SpecificVersion>false</SpecificVersion>
</Reference>

C:\...\binaries 包含 MyDll.dll

但是,在构建过程中我仍然得到

warning MSB3245: Could not resolve this reference. Could not locate the assembly "MyDll". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.

我正在尝试从 HintPath 切换到 ReferencePath,因为它们变得难以维护。

最佳答案

在新的 SDK csproj 中,您可以使用 AssemblySearchPaths 变量代替 ReferencePath 变量来影响程序集探测

<AssemblySearchPaths>
$(YOUR_SEMICOLON_SEPARATED_DIR_PATHS);$(AssemblySearchPaths);
</AssemblySearchPaths>

但是,要小心旧的 .NET Framework 项目,因为这个技巧不起作用。

关于csproj - ReferencePath 与新的.NET SDK?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52433526/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com