Missing assembly reference in build

I have a VS2017 solution that I am running through TeamCity and I am getting an error during my build:

[Csc] XXX.cs(5, 19): error CS0234: The type or namespace name 'YYY' does not exist in the namespace 'ZZZ' (are you missing an assembly reference?)

This same reference is in another project in the same solution and is being built correctly.

I have checked the csproj files of both projects and they both reference the same package in the same format:

 <ItemGroup>
...
<PackageReference Include="ZZZ.YYY" Version="2.1.0" />
...
</ItemGroup>

I can build locally (and after a clean - rebuild etc...) with no issues.

I have checked the MSBuild logs and can't see what would be causing this.

Can anyone point me in the right direction from here?

 

EDIT: I've noticed in the TeamCity build log that only one project in the list is not having it's packages restored and this is the project that is failing to build.

EDIT 2: I can see the error at the compile command csc.exe. There is no reference to the assembly missing above in the compile arguments. This begs the question as to why the assembly isn't being restored, which I still don't know why.

0
5 comments

Hi Bernie,

which version of teamcity are you using? Please note that support for vs2017 projects was introduced relatively recently. This issue seems to include the same problem: https://youtrack.jetbrains.com/issue/TW-48730, and as mentioned, it's fixed in newer releases.

If you are using an old version, could you try upgrading and seeing if it works?

0
Avatar
Permanently deleted user

Hi Denis,

We are using Version 2017.1.2 (build 46812)

Would you expect this version to have the issues fix in the bug report you linked to?

I think we are behind the current 2017.1.3 version.

I'll talk to IT about upgrading but it may not happen quickly.

 

0

Hi Bernie,

in the issue I linked it's displayed that the issue was fixed in 2017.1.3, if it is the same issue producing the problem, then yes, I would expect that upgrading would fix it. I would recommend reading through the comments for further insight on what causes it

An option to not have to upgrade would be to install a test server with 2017.1.3, replicate the configuration and see whether it works or fails.

0
Avatar
Permanently deleted user

Hi Denis,

I'm using TeamCity Enterprise 2017.2.4 (build 51228) and still, I have the same problem.

My MSBuild version is 15.9.21. 

 

 

0

Hi Hamid,

 

by now, version 2017.2.4 is already out of support, and a number of fixes have been introduced in the meantime. I'd still recommend upgrading and seeing whether the issue replicates in a newer version. If it does, please open an issue in our tracker: https://youtrack.jetbrains.com/issues/TW. Provide the full build log, and if you could create a small sample project that replicates the issue that you could share, that would make it much easier for our devs to fix it.

0

Please sign in to leave a comment.