gpt4 book ai didi

.net - Visual Studio 构建错误 -> Microsoft.DotNet.Common.Targets : DLL could not be found

转载 作者:行者123 更新时间:2023-12-04 18:59:48 24 4
gpt4 key购买 nike

我使用的是 Visual Studio 2015 Update 3,其中我使用的是 NET Core,我有三个类库。这是我的类库:

enter image description here

  • ClassLibrary1 引用 -> Microsoft.Extensions.Caching.Redis
  • ClassLibrary1 使用 .NETCoreApp 1.0,而缓存 Redis 使用 .NET Standard 1.5

  • 我的问题是当我构建我的解决方案时,似乎 ClassLibrary1 找不到 Redis 的 dll,因为 dll 被放置在解决方案目录的 artifact 文件夹中。

    如果我检查构建输出,它会说:
    C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Common.Targets(262,5)


    error : C:\Caching-1.0.0\src\ClassLibrary1\error CS0006:
    Metadata file 'C:\Caching1.0.0\src\Microsoft.Extensions.Caching.Redis\bin\Debug\netstandard1.5\Microsoft.Extensions.Caching.Redis.dll'
    could not be found

    第 262 行:Microsoft.DotNet.Common.Targets

    enter image description here

    似乎 dll 已构建并放置在项目解决方案的 artifacts 文件夹目录中。项目的文件系统结构为:

    enter image description here

    Caing 项目中没有任何 bin 文件夹,我如何更改它以在相应的项目中生成 bin?

    最佳答案

    我检查了缓存项目的 xproj 文件,它包含构建信息,它将输出重定向到工件文件夹:

    <BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>


    <OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\</OutputPath>

    我将它们都更改为指向其项目文件夹目录
  • BaseIntermediateOutputPath -> .\obj\$(MSBuildProjectName)
  • 输出路径 -> .\bin\

  • 然后, classLibrary1 现在可以找到所需的引用 dll。

    关于.net - Visual Studio 构建错误 -> Microsoft.DotNet.Common.Targets : DLL could not be found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40411029/

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