It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Project will not build using MSBuild Edited

I am currently trying to use MSBuild to build out a test project. For some reason it keeps giving me errors:
Class name : error CS0246: The type or namespace name 'ClosedXML' could not be found (are you missing a using directive or an assembly reference?)

But all the references are there within the project. I even uninstalled\reinstalled the NuGet packages and pushed the changes to my branch and it still will not build.  I am new to Bamboo and have tried looking at the documentation and tried to find videos on this, and I haven't found anything. 

2 answers

0 votes

Hi @Anthony Fiori,

  • Are you able to build your MSBuild project from outside Bamboo without issues?
  • If it runs fine, have you checked if you have the same environment variables needed in the agent trying to build your project?

Usually Bamboo tasks are just wrappers for external commands and should give you the same results you get from the terminal, this is why I'm asking you to check this from your terminal first. 

You may try navigating to the build working directory right after the failed build and try to run the MSBuild from there.

Hi, @Daniel Santos

Sorry for the late reply, So I was able to get somewhat of the project to build now, found out I had to reload the nuget packages before the build. Also had to install frameworks for it to build projects. Still, on that part, the build keeps erroring out on errors like this:
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\amd64\Microsoft.Common.CurrentVersion.targets(1179,5): error MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.6.2" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed.

 

So the main question is for Bamboo to actually build the project with no issues, would I need VS installed on the same server, manually build it on the server to make sure it works and then hook up bamboo to build the project? Currently, I can build the solution perfectly fine on my dev machine

Let me highlight 2 points that in my opinion usually need more attention:

  1. Windows environment variables will rely on the parent process environment and on what user is running the current process. This means that you always have to make sure the Bamboo agent running your build has the variables you need to properly run your build.
    You can check if the variables are available through an Script task with the command SET.
  2. Bamboo is an automation tool. It will start, stop and collect data from external applications automated by it. What I'm trying to say is that when troubleshooting a build problem, if you are not sure where it is the issue, you should make sure all the tools Bamboo is automating can properly work without Bamboo first.
    (!) Please notice that you need to test in the same agent used to process your build. If you have a remote agent you need to test there. If you have a local agent you need to test in the server machine.

Please check if the variables that you have in your terminal are the same ones you have when running the build. If the build is running on terminal it should also run in Bamboo, it just need small adjustments.

Not a 100% sure what you mean by Windows environment variables. I don't know if I explained the issue correctly. The problem we're currently running into is that the build keeps failing on Bamboo because of Assembly references for .NetFramework versions. Off our Bamboo server and on my local machine I am able to check out our Git repository and have no issues building the entire solution. I build it through VS17, but some projects are still targetted for VS15. The difference on the Bamboo server is that we do not have VS installed, so I am wondering if that's what we would need to do, because when you install VS you select multiple frameworks that you need and would get installed. As of right now, we have been having to individually install the frameworks, because of each error we're receiving. Ideally, we don't want to install VS on the server because of space and integrity of the server.  I'm not sure to resolve this type of issue if there are any other ways to resolve this, with having to install VS

@Daniel Santos was able to pass the assembly problems I actually had to copy my v4.6.2 for the framework over to the server. I am getting this error though:

error MSB3171: Problem generating manifest. Access to the path is denied. 

@Daniel Santos 

I got everything up an running, was able to check out and build the sln.  The only thing I am noticing is it will execute my exe's and it will succeed, but when I go to run the task again it fails.

Hi @Anthony Fiori

I'm sorry! Somehow I missed your last notifications. I'm glad that you were able to fix the problems there.

  • Can you share the error you get here?
  • Is the problem happening only when you rerun the build? 

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bamboo

Unable to add or edit Bitbucket Cloud repository in Bamboo

On 31 May, a GDPR-related change went live in the Bitbucket Cloud API that resulted in users not being able to create or edit Bitbucket Cloud Linked repositories in Bamboo. This API update removed t...

695 views 2 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you