首页 文章

Bitbucket管道:找不到类型或命名空间名称

提问于
浏览
1

我希望有人可以帮助我 . 谢谢!

我正在尝试部署我的dotnet core 2.0 API

当我尝试用bitbucket管道构建项目时,我发现多个错误找到引用 . 它确实成功恢复了项目 .

但是该项目在我的笔记本电脑上成功构建

文件夹结构:

/API
  /Controllers
  /Migrations
  /Models
  /Services
  API.csproj
  Program.cs
  Startup.cs

到位桶,pipelines.yml

pipelines:
  default:
    - step:
        image: microsoft/dotnet
        name: Check if it builds
        script:
          - cd API
          - dotnet build

示例错误:

Services/MyService.cs(18,29): error CS0246: The type or namespace name 'IRepository<>' could not be found (are you missing a using directive or an assembly reference?) [/opt/atlassian/pipelines/agent/build/API/API.csproj]

Note 我有最新版本的dotnet,就像我在bitbucket管道中使用的那样 . 我已通过运行 dotnet --info 进行了检查

1 回答

  • 1

    最后我弄清楚了这个问题的原因是什么 . 我觉得很快就不能搞清楚这一点 .

    我的git存储库以某种方式设置为ignorecase = true . 我已将其切换为false(将来会阻止此问题) .

    这意味着我可以拥有两个相同的文件或文件夹 .

    我已将文件夹重命名为其他案例 . 我的回购了

    API/
      API.csproj
    

    api/
      api.csproj
    

    我的Mac无法同时允许这两个,所以我只在本地计算机上看到一个文件夹和一个项目 .

    要解决这个问题,我不得不 git rm -r --cached api

    这删除了重复文件夹

    我将项目文件作为副本,因此使用 git rm -f api.csproj 从存储库中删除文件 .

    然后 git pull 将这些更改带到我的本地主分支 .

相关问题