Build solution with multiple projects - msbuild

I have following project in one solution.
MVC Web Project
WPF Project
Library project common to both projects.
How can I build above projects & publish the output for MVC Web & WPF project to some directory using MSBuild command?

What you want is Maven. Apache Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project's build, reporting and documentation from a central piece of information.

Related

Team Services releasing wrong project in multi-project solution

I've been setting up Continuous integration, and deployment in Team Foundation Server Online. When VSTSreleases the build to the DEV server (with the IIS Deployment template) the wrong project is being released.
The image below shows the project structure in my solution (asp.net core). I just need to deploy the WebApp.Web.MVC project which has dependencies on several other projects in the solution. Instead, VSTS deploys the WebApp.Application.Shared project.
I've tried moving the MVC project to the top of the list by putting an A in front of it. Also tried adding a parameter in the VSTS build definition with name 'Project' and value 'WebApp.Web.Mvc'. No results though.
So I've managed to solve this problem by doing the following:
I added an additional step in the build process, first the entire solution is build, and then the second step is to build only the MVC project by referring to the mvc.csproj. Now, only the MVC project and its dependencies are being released to the IIS website.
Entire solution
Only MVC project

Bamboo configuration as code for .NET project

Configuration as code looks like it's purely for Maven type projects.
Would it be unwise to use this for a .NET project? We're doing micro-services built in .net/C# and want to take advantage of the re usability and not have to live in a clone-driven process.
this is a pretty new feature, and tbh I haven't looked at it yet - but, as I understand it from their documentation, they are providing tools for you to author and publish build plans or deployment projects that are Java and Maven based, but the project you are building in that plan could be any technology.
So if you were building a .NET app with MSBUILD, you would write java code to define a build plan that uses at some point an MSBUILD task:
https://docs.atlassian.com/bamboo-specs/latest/com/atlassian/bamboo/specs/builders/task/MsBuildTask.html
And you would publish that plan from the java code using their maven goal
mvn -Ppublish-specs
But once it is in Bamboo and runs, the system its building is your .NET service.
Again I have not tried this yet, but that is my understanding.

Team City build with 2 web projects

Apologies if this is basic, but I seem to just be missing something.
I have a single solution with multiple class libraries and 2 MVC 4 web applications.
I've had one of those web projects for ages, and a Team City CI build that generates an artifact that I then deploy via Octopus Deploy. This works great.
I can't figure out the simplest way to either generate a 2nd artifact for the 2nd web project (same tc build, or a different one, I don't care).
End result: I want both web projects to be deployed to the same environments (IIS 7), with the 2nd site simply on a different port. I don't need TC to do anything special, just nuget restore, build, then generate the artifact.
If you always want to deploy both web applications at the same time. E.g they have some shared code libraries, then it's best to setup the deployments as multiple build configurations in a single project.
E.g
Build project A
Build project B
Deploy project A
Deploy project B
If you want to build and deploy the applications separately, then setup the two separate projects. This will allow you to have different build triggers, deploy schedules for both applications.
E.g.
Project A
Build
Deploy
Project B
Build
Deploy
In addition to this, you will need to have a nuget package for each web application. That means you need to run Octopack for each web app and have a nuspec file. Each project will need to generate its own nuget package artifact. In Octopus deploy, you need to either setup a single project with 2 steps or have 2 projects.

MSBuild: (WebDeploy) Web package creation for selected web projects

I managed to get TFS 2010 to create Web Deployment ZIPs (WebDeploy).
Now the issue is that I have multiple Web projects in the solution and packages are being created for all web projects.
In the projects that I do not want a package, I uncheck the "Create deployment package as a zip". I thought this will prevent MSBuild from creating a deployment package.
BTW I am passing "/p:DeployOnBuild=true" to MSBuild.
Is there a way to get MSBuild only package selected projects and not all Web projects?
Thanks.
Ok. Found the solution. Many thanks to Vishal Joshi for this post.
Extract from the post:
"
Deployment for Web Apps is feasible at both Solution as well as Project build level although when it comes to Solution Build then you might want to make sure that the properties you are passing at Solution level will apply to all the projects in the solution which might not always the outcome you desire. In that situation all these properties can be set within the .csproj or .vbproj files too. You can do that by unloading your project file and in the top <PropertyGroup> section just add above properties as you like:
For e.g /p:DeployOnBuild=True can be added as <DeployOnBuild>True</DeployOnBuild>
"
So, the solution was to remove /p:DeployOnBuild=true from TFS Build process template and update only the project files that require a package.

aspnet_compiler and msbuild.exe

I am pretty new to msbuild and aspnet_compiler.
I am using aspnet_compiler to compile web application project. Now I just saw the MSBuild.exe and noticed that its builds my website into the /mywebsite/precompiledWeb folder. Now why do I need to use MSBuild.exe? Can't I directly use the aspnet_compiler to see if my website can be built properly?
(Not sure if I explained it very well).
msbuild.exe is usually used to build projects and its dependencies. When you have a web application project with a project file, vs can use this to build not only your web project but all the dependencies involved. This would only build your source code files, not the markup files (.aspx,.ascx,.etc).
aspnet_compiler is meant to build a web site project that doesn't have a project file. This said, you can also use it to make sure your markup files are also built for your web application project.
You are correct you can manually invoke the aspnet_compiler.exe tool. But better would be to use Web Deployment Projects to help you do this.