Search code examples
c#visual-studiocsprojsolution

How to fix "msbuild 4040: There is no target in the project."


I am currently developing a solution with two web projects and a test project. I added a fourth project, a class library to the solution and everything builds fine locally. But when I ran my branch in Azure DevOps through my build pipeline it fails with an error code 4040 and says the there is no target in the new project/class library I created. So far all the help i have found online hasn't done anything for me.

I have tried adding a nuget.build.pack (something to that effect) to my class library project but it still errors.

I literally have no idea where to go from here and need to make sure that the build passes on ADO before making a pull request. Any help is appreciated.


Solution

  • Figured out the problem, so I will post for any future users with the same issue. My problem was that I had added a .NET Standard class library to my solution when all of my other projects were .NET Framework projects. I simply added a new project to my solution but selected the .NET Framework Class Library then copied the contents over and deleted the old one, and wired up all the references to the new one. Fixed the issue.