setup NSIS build in Bamboo - asp.net-mvc

I have to setup build process in Bamboo server. My requirements are,
We have a web-server application [more than 20 web projects, 10 windows service projects, DB scripts, some supported utilities like exe, xml's, code signing certificates, ssl certificates]
We have already build automation in c#, which uses NSIS scripts to generate installer.exe
Our build process has the following steps:
Checkout the source code
Checkout the Utilities
Checkout the NSIS installer source code
Update the source code
Update the Utilities
Update the Product versions in all the Assembly files of all the projects & Wix files
Build all the MSI projects based from the list [Project.xml] -> Once build completed with Code Signing post build CMD, then move to
some [ex: LatestPackage] folder in any [ex: Package] directory
Build all the Web app projects from the list [Project.xml] -> Publish into some [ex: LatestPackage] folder in any [ex: Package]
directory
Build all the support projects for installer from the list [Project.xml]
Copy the "LatestPackage" from "Package" directory to "LatestPackage" folder in "NSIS Installer" directory
Update the Installer source codes
Copy the installer custom assets to respective folder in "Installer" directory [SQL, some exe's]
Update Installer.xml file with the Branding information's in "Installer" directory
Compile Installer.nsi file & Installer package will be generated under Installer directory
Could anyone guide me in right path to achieve this.
1. Need to setup task for each and every projects?
2. Where to keep the files once build completed?
3. How to move the all the projects binaries into another projects directory?
4. How to keep the supported files and copy them to our source code folders?
5. How to maintain the generated build?

Is Bamboo Server Windows based? Can Visual Studio be installed on it?
If yes then you can automate building NSIS installers using MSBuild and Visual & Installer.
Also (if VS is present) there is an option to create NSIS project in Visual Studio and build the installer from it (building the solution from command line).

Related

How to configure vcpkg for multi project solution

I am seeking advice on how to proper configure a multi project solution in relation to third party c++ libraries added with vcpkg.
How do you checkout a specific version of a library for a project?
How do you configure Visual Studio 2019 to use this version for debug and release (lib, dll, headers)?
How do I share the configuration with other developers and build servers?
Here is how I did it:
fork vcpkg repo to local repository (TFS Git in my case)
make a project-specific branch (project being internal company project, not Visual Studio project)
pile on my own port modifications
add few scripts that build a package containing only libraries aforementioned project needs (nuget on windows, 7zip for Linux), see vcpkg export command
label with package version (e.g. 1.0.0.2)
build and deploy to a share (that is properly backed up)
configure some IIS instance in company network to serve packages from aforementioned share
in Visual Studio related projects refer to nuget package
on Linux related cmake script pulls correct version of package using http GET, unpacks it and imports vcpkg cmake file
every time a change needs to be made to the package:
modify your vcpkg branch, label with next version and push
build new package version (filename should contain version)
deploy package to that share
update your cmake files and/or nuget config files
I also tried to export only 1 library (cpprestsdk) but instead vcpkg just exported everything it had installed! Can't it just export the dependent libs only?
vcpkg export cpprestsdk:x64-windows --zip

VSTS Solution build fails on classic ASP.NET

I have a large visual studio solution using multiple NUGET packages and multiple projects to build an asp.net web project. When I build locally using VS 2017, the build works correctly. I have an on-premise TFS 2014 server (soon to be retired) and use it to build the solution successfully using my TFS build server. I moved the source code to a VSTS project and defined a locally hosted build pipeline using the same build server that I use for TFS 2014. I have used this same build server with other VSTS project pipelines successfully.
My web project builds all the projects correctly (I can see it in the log and looking on my build server, I can see all the dlls in the c:\Agent_work\n\a directory including packages (from the built projects) or the built projects. The final project to build is the web project. It fails to find the other projects needed to build this final project.
I find this curious since some of the other projects in the solution have dependencies to other projects in the solution and build correctly. I have examined the web project .csproj file and the .sln file, and I see no issues in the references to these dependent projects.
I solved this issue by switching the pipeline step from visual studio build to msbuild.

Nuget Restore in MS Build Step

In my asp.net web application, i have solution with 5 projects and nuget.org. In TFS Build Definition,
1) While building the whole solution in Visual Studio Build Task
Nuget packages getting restored.
2) While trying to generate executable files for individual projects in MS Build Task
If I select Restore Nuget packages, It's not finding nuget packages and step getting failed with message - "Process 'NuGet.exe' exited with code '1'."
I have tried many references online and none worked. Any suggestions on how to solve this?
Do i need to make any changes in the nuget.config file to support restoring
packages to individual projects.
Do not directly select Restore Nuget pacakges in MS build task configuration. This option is deprecated. To restore NuGet packages, add a NuGet Installer step before the build.
(Important) This option is deprecated. Make sure to clear this
checkbox and instead use the NuGet Installer build step.
Source Link: MSBuild
Besides, you could also build single project not the entire solution in Visual Studio Build task. Just select the project (.*proj) files instead of .sln file.
Unless you are building a customized MSBuild project file, then we recommend you use the MSBuild step instead of the Visual Studio Build step.
You could also try to build single project using Visual Studio Build task, see if the issue is still exists.
Same problem, downgraded to 4.4.1. it helped

Setup ASP.NET MVC 4 or 5 project with Angular 2

I am learning angular 2 with Typescript.
I am using following resource.
QuickStart with Angular 2
Now from there and other examples i found that they telling to create package.json file that lists all dependencies for project.
I think creating this package.json file and listing all dependency packages this kind of structure is followed in .NetCore Project.
In MVC 4 or 5 we have packages.config file which lists although packages that we are going to use.
I am not saying we can not use package.json file when we have package.config file.
But is there any simple way to integrate Angular 2 with typescript in MVC Webapplication project using NUGet Packages and get started?
If not available please let me know how can i setup Angular 2 with type script in ASP.Net MVC 4 or 5?
As you said, in ASP.NET MVC application you have a package.config file. This file holds the information about NuGet packages you've installed in your app. This file is related to the server-side packages.
package.json file is related to a front-end part of your app. It also holds list of packages that you've installed in your app. This time npm packages. It also holds information about your app and more. You can read more about it here.
You can't mix those files and you don't want to. Firstly, those files have different format (XML and JSON). In addition, as I said before, they hold information about different parts of your application. Lastly, and this is my personal opinion, when you create application with rich UI and use Angular2, it'd be better to split the parts of your app into 2 different projects. One of them with Web APIs and the second with the UI part only. With such structure, you will no need for packages.config in UI project and no need for package.json in Web API project.
For you last question, you can start with here. You also can take a look on this sample app.
In order to run Angular 2 in an ASP.NET MVC 4.5 (VS 2015):
1) install Node.js (at least 4.4.x), npm (at least 3.x.x) and TypeScript for Visual Studio 2015 (VS -> Tools -> Extensions and Updates -> Online). You may check your version of node and npm by running the following in the terminal: "node -v" and "npm -v".
2) copy the QuickStart files (everything what quickstart-master constains, not the folder itself) into your project (to the folder containing the .csproj file) - you can download the QuickStart files from: https://github.com/angular/quickstart
3) In the Solution Explorer click "show all files" (probably the third icon from the right, just above the search bar). Select the following files/folders and include them in the project:
app folder (answer No if asked to search for TypeScript Typings)
styles.css
index.html
package.json
tsconfig.json
typings.json
4) In Visual Studio, right click on "package.json" and select "Restore Packages" - this will install all of the packages defined in the package.json into your project.
The result of this operation is the same as running "npm install" in your project location from the terminal.
Probably there'll be some warnings in the Output window - ignore them. A new folder called "node_modules" will be generated (you need to refresh the Solution Explorer to be able to see it) - advice is not to include this folder in the project.
5) In the tsconfig.json file, next to "compilerOptions" add the following:
"compileOnSave": true
as shown below
{
"compilerOptions": {
...
},
"compileOnSave": true
}
Restart Visual Studio.
6) In Visual Studio, right click on "index.html" and click "Set as Start Page".
As a reference, here's the official documentation for running Angular
2 (quickstart) in ASP.NET 4.x (Visual Studio 2015):
https://angular.io/docs/ts/latest/cookbook/visual-studio-2015.html
Also check out the link which includes steps to run.
You need to include package.json (Angular 2 gets installed using NPM)
Run NPM install
Run the GULP tasks
Run F5 to see results.
https://github.com/mithunvp/ng2Mvc5Demo
As its already accepted still it will be alternate way to get started
If You want to install Angular4 on nuget package manager console you can use Install-Package Angular4 -Version 1.1.0 and follow these steps:
Angular 4
*********
Prerequisites
`````````````
1. Download and Install Node js
2. Install Visual studio 2015 update 3 or above
3. Download and Install TypeScript 2.6.1 for Visual Studio 2015 (https://www.typescriptlang.org/#download-links)
Follow the steps to install package.
````````````````````````````````````
1. Create an new project with empty template and include dependencies for MVC and WebApi to the project
2. Install the package using command 'Install-Package Angular4 -Version 1.1.0'
Follow the steps after package installation
```````````````````````````````````````````
1. Open Node.js Command Prompt
2. Navigate to project location(use commands such as pushd,cd etc)
3. Run the command 'npm install'

TFS (web) gives error when building Typescript. TypeScript.targets not found

We just converted our javascript files to typescript. Everything builds locally just fine but our build in TFS (cloud version i.e. tfs.visualstudio.com) gave us the error:
The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\TypeScript\Microsoft.TypeScript.targets"
was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.
Locally we are using typescript version 0.9.1.1 and VS2012
And advise?
To ensure that Web projects using Microsoft.TypeScript.targets will build successfully on a build server, you have two options:
Install TypeScript on the build server
Copy the required files for Microsoft.TypeScript.targets to a different source-controlled folder and change the path references in
the csproj file to this folder.
More details here => http://typescript.codeplex.com/workitem/1518
Usually this is because you haven't installed the TypeScript extension on the build server - it will need the same installer you used locally.
This will put tsc.exe into the SDK/Typescript folder and allow the build server to build your TypeScript files and check all your types.
I had to install Visual Studio 2013 RC2 to get TypeScript installed by default and get rid of this error message, instead of trying to download a package.
It can be found here:
http://www.microsoft.com/fr-fr/download/details.aspx?id=42666
This message usually throws when you cancelled the installation of VS or changed the Typescript version or failed to install the Typescript SDK for the corresponding Visual Studio Edition. Download and install the Typescript SDK can get you rid of this error.
Here is the link for downloading SDK for VS2017.
https://www.microsoft.com/en-us/download/confirmation.aspx?id=55258

Resources