.Net Core Project Building in VSTS & TFS 2015/2017 (Error MSB4041 Solution)

In this post, we will try using new Visual Studio Team Services(VSTS) or Team Foundation Server(TFS) to build our .Net Core Console project.

If you get the Error “error MSB4041: The default XML namespace of the project must be the MSBuild XML namespace. please go to the 4. Run Build in TFS” below directly to get the solution.

VSTS is a service from Microsoft, offering the similar support from TFS. Therefore, you can enjoy almost the same services and functions as from the TFS, and you don’t need to build your TFS server. For the pricing of VSTS, please check the detail from their website and pricing. If you just do it as a personal project, I think it is a free to go. Please check the last updated information.

In this post, I will refer TFS as VSTS and TFS together.

1. A .Net Core Project in Your Local

To begin with, we need a “good to go” Core project. Since we are new to the new technologies, we need to make sure all our project and codes are bug-free and built without issues in our local, then we can try the TFS without worrying about the code.

I already had a .Core application in my local and I have published to my Github at https://github.com/Lukas1882/SqlReportHelper, or, you can build a new blank Console Application using the “New Application” in your Visual Studio. We don’t care what is the project, just make sure it is built and run well in your local.

. Upload Your Project into TFS

In here, I will show the step in VSTS, and there is similar step in TFS.

In your VSTS home page, click the “New Project”, create your new project in TFS.

In there, I choose Git, since I will push from my local Git.

Next, if everything is good, you may get the window below.

Since we need to publish our code into the server, therefore, we choose “Push an existing repository from the command line”. You may use another approach to upload your project.

I wish you know how to use git to push your code into the remote, if not, please check google online for the details. Since I already have a remote server to Github, therefore, I copied my whole repository and deleted the .git folder in the new folder. After that, I  created a new git repository to point to this new remote server. (Because I don’t want the trouble to switch between the two remote server….)

3. Set Up Build in TFS

If you successfully upload your project into the server, after refresh your TFS web page above, you may get this new page. Cool! Let’s build our new Building.

If you didn’t get this page, please check whether you get this menu. Click the tag “Code” to check your code is good in the server side, then click the “Build & Release”. If worse, you even could not see this menu, maybe you need to check your steps and try some help online…

If you click no any button, like “Add New Build”,  “New Build”, you may get the following picture. In our case, we only try a .net core console app, please choose the normal “Visual Studio” as your build template.

After that, you may get the following window.

In here, we only need to make sure in the “Nuget” section, make the installation type as Restore and the NeGet Version is the version in your Visual Studio. In order to get the version from Visual Studio, please click the “Help => About Microsoft Visual Studio” to get the version number.

In the “Build Solution”, please make sure the “Visual Studio Version” is the one in your local VS

For other configuration, we just leave them still, we can still modify them later. Please understand that, since the TFS server is changing and our local environment could be different, you may need to modify later based your error messag.

4. Run Build in TFS (Solution for with Solution of Error MSB4041)

Now, let’s rock.

Click the “Save & Queue”, your project will be built on the server side.

Now, very important.

If your local VS is 2017, please make sure the Agent queue is “Hosted VS2017”.

I didn’t notice it at the very first, and I am using VS 2017, therefore, I kept get the Error MSB4041. In my case, I solved the error by change this dropdown to “Hosted VS2017″.

Then, click “Queue”.

If everything is good, you may get this result, partially succeeded. Since we didn’t set our publish target path, therefore, we could not publish our built solution. In our future post, we will discuss more details about the publish and unit testing.

1 comments On .Net Core Project Building in VSTS & TFS 2015/2017 (Error MSB4041 Solution)

Leave a reply:

Your email address will not be published.

Site Footer