The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

dotnet The type or namespace name could not be found

jasperdunn
March 29, 2018

I'm hoping someone can help me out. Thanks!

I'm trying to deploy my dotnet core 2.0 API

When I try and build the project with bitbucket pipelines I get multiple errors finding references. It does restore the project successfully.

However the project builds successfully on my laptop.

folder structure:

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

bitbucket-pipelines.yml

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

example error:


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 I have the latest version of dotnet, same as I'm using in bitbucket pipelines. I have checked via running dotnet --info

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
jasperdunn
April 3, 2018

Finally i've figured out what was the cause of this issue. I feel really silly for not figuring this out sooner.

My git repository was somehow setup with ignorecase = true. I have switched it to false (which will prevent this issue in the future).

This means that I can have two of the same files or folders.

I had renamed a folder to a different case. My repo had

API/
API.csproj
and

api/
api.csproj

My Mac couldn't allow for both so I only saw one folder and one project on my local machine.

To fix this, I had to git rm -r --cached api

This deleted the duplicate folder

I had the project file as a duplicate as well so used git rm -f api.csproj to remove the file from the repository.

Then git pull to bring those changes into my local master branch.

1 vote
Philip Hodder
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 3, 2018

Hi Jasper,

When you are running this locally, are you running this inside of a Docker container? This seems like it could be a dependency / configuration problem, where your local environment will already be setup correctly.

Try following this guide to run this build in a local Docker container: https://confluence.atlassian.com/bitbucket/debug-your-pipelines-locally-with-docker-838273569.html Then you may be able to reproduce this issue locally instead.

Thanks,

Phil

jasperdunn
April 3, 2018

Thanks Philip, I’ll definitely take a look at this next time! I figured out my issue. 

TAGS
AUG Leaders

Atlassian Community Events