0

Errors are returned on builds from a TFS2017 build agent for an MVC website solution with 4 projects as generally described below.

The MVC project
A test project
A class library as the domain layer
A class library as the storage/infrastructure layer

There are about 20 errors in the log output, but the error below with regard to the EntityFramework assembly is the first one (a second error is similar with regard to the EntityFramework.SqlServer assembly). These errors seem to be the source of the overall build problems.

C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(2110,5): Warning MSB3245: Could not resolve this reference. Could not locate the assembly "EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.

The code compiles, runs in debug, and operates at the hosting location using VS2017 publishing tools. I am trying to get the build server online. The build server has VS2017 installed.

Why would the entity framework assemblies not be accessible to MSbuild on the build server and how do I correct that?

Alan
  • 1,587
  • 3
  • 23
  • 43
  • Hi Alan, do you have a VS2017 IDE in build server or just VS2017 build tools in your build server? And what the result if build the solution in your server only with VS IDE or msbuild command-line?(the result without using TFS?) – LoLance Mar 20 '19 at 05:37
  • Build server has full VS2017 configured w/ same features as desktop IDE. I tried build server IDE manually & it failed; I opened solution located in `c:\agent\_work\1\…` Wouldn't build because reference folder is missing DLLs & NuGet wouldn't repair reference folders. 1 thing led to another & I messed up my IDE solution. When I pulled from TFS I was reminded TFS doesn't store DLLs unless you force it, so I'm fixing that - If TFS has the DLLs, then perhaps build server will succeed. Am I missing something in both NuGet IDE & on build server that doesn't restore DLLs when needed? – Alan Mar 20 '19 at 12:10
  • Following up, including in TFS source control all files in all Package folders allowed me to build the project on the build server successfully. However, I am troubled that NuGet on the build server didn't properly update the reference DLLs. As I indicated, I always assume I'm doing something wrong, but I don't immediately see a setting for NuGet to cause it to refresh the DLLs. – Alan Mar 20 '19 at 13:17
  • In your local vs where builds the project successfully, open Tools=>options=>Nuget Package Manager, check if the package source in your local machine is same as what you have in your server machine. – LoLance Mar 21 '19 at 03:01
  • And in your server VS IDE,Tools=>options=>Nuget Package Manager=>general to make sure you've checked the 1.Allow nuget to download missing nuget packages and 2.Automatically check for missing packages during build in VS studio (Do this action in vs ide in server first) – LoLance Mar 21 '19 at 03:03
  • All of the settings you suggest are already set as you suggest, in both locations. I believe those must be the defaults because I didn't or never would go against defaults without a reason to do so. – Alan Mar 21 '19 at 11:59
  • Hi Alan, when you first get the issue? Have you added a "nuget restore task" into the build process like [this](https://www.google.com/search?q=build+definition+in+tfs+nuget+restore&rlz=1C1CHZL_enSG828SG828&tbm=isch&source=iu&ictx=1&fir=R6bXvGuRn15l1M%253A%252ChlA3Jkcqcx-EQM%252C_&vet=1&usg=AI4_-kQvIAlO0Dqc2m4okcxMfkS0T8KxLg&sa=X&ved=2ahUKEwiApKXHtJXhAhWP7mEKHRHBCjIQ9QEwAHoECAwQBg#imgrc=R6bXvGuRn15l1M:&vet=1)? – LoLance Mar 22 '19 at 09:19
  • Yes, I do have a NuGet task 2nd in line as your screenshot. There's a lot of version numbers on right side, but I don't understand why that would impact this problem. I don't want to mess up my current project, so I'm going to leave well-enough alone and just accept keeping the packages in version control. But on my next project I'll revisit this. I thought NuGet would refresh packages, but it's not. Not even on my development machine. I had to go to another project and copy the dlls manually to fix the project. I couldn't delete them or refresh them. – Alan Mar 26 '19 at 14:46
  • Hi, what's your first task, what about adding the 'nuget restore' as the first task? Maybe it works better. – LoLance Mar 28 '19 at 02:52
  • Take a look at the answer from [James](https://stackoverflow.com/questions/31430072/tfs-build-fails-but-visual-studio-works), it may get you some help. – LoLance Mar 28 '19 at 03:08

0 Answers0