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

时间:2018-03-29 08:20:05

标签: .net-core bitbucket bitbucket-pipelines

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

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

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

然而,该项目在我的笔记本电脑上成功构建。

文件夹结构:

T1         := _release
T2         := _debug
T3         := _test
suffixes   := T1 T2 T3
patternabc := $(foreach suffix,$(suffixes),%in/abc$($(suffix)).bin) %in/rev.txt
patternxyz := $(foreach suffix,$(suffixes),%in/xyz$($(suffix)).bin)

include version.mk

all:   bin/mybin_release_$(VER).bin
debug: bin/mybin_debug_$(VER).bin
debug: export DBG:=1
test:  bin/mybin_test_$(VER).bin
test:  export TST:=1

version.mk: bin/rev.txt
    { printf 'VER = '; cat $<; } > $@

$(patternabc):
    $(MAKE) -C mod1

$(patternxyz):
    $(MAKE) -C mod2

bin/mybin%_$(VER).bin: bin/abc%.bin bin/xyz%.bin
    cat $^ > $@

到位桶-pipelines.yml

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

示例错误:

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

注意我有最新版本的dotnet,就像我在bitbucket管道中使用的那样。我已经通过运行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]

进行了检查

1 个答案:

答案 0 :(得分:1)

最后我已经弄明白这个问题的原因是什么。我觉得很快就没有把它搞清楚了。

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

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

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

API/
  API.csproj

api/
  api.csproj

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

要解决此问题,我必须git rm -r --cached api

删除了重复文件夹

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

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

相关问题