Posts

Jenkins - AzureDevOps trigger a job after push to git

Image
About Azure DevOps trigger a build job, which an article about TFS before. Recently, We are planning to transfer a source control from TFS to git. So I need to run the full scenario and note them. Azure DevOps Setting 1.Clone repository : Copy the clone URL. 2.Create a Personal Access Token This token will used by Jenkin. 3.Add a Service hook: Check-in build Project Settings>Service hooks  Choosing the type of trigger and repository. The User Name and API Token which created from Jenkins. ps:Integration Level needs choosing Build-in Jenkins API Jenkins Setting Source control:Enter the git, the clone URL, and the credentials which just adding from the git server. Reference https://docs.microsoft.com/en-us/azure/devops/service-hooks/services/jenkins?view=vsts

Blazor Hello world

Image
My colleague shared an article about ASP.NET Blazor how to implement "Web Assembly".Today, I try a classic sample, Of course, For new guys to enter the door  "Hello world" is the best choice. Setup Opening the extension tool to search the word "blazor"  you will find the package "ASP.NET Core Blazor Language Service".As you can see the name it means you need to be used ".Net core". Choose Project Template After installed, When we created a new project which will show more three templates. Basic Client Side Project,: Basically, this can run well but normally we will split it to client and backend so we don't use it. ServerAPI+Shared+Client Side: We use this,  it is the most standard layer architecture. Ps: Template 1 and 2 will load assembly to browser through blazor.webassembly.js to render HTML. ServerAPI+Shared+Server Side: This is similar No.2 the different is it will not load assembly to the browser.A

VS2017.15.8.4 Error fixed

Image
Recently, I am a bit of fear to upgrade VS2017. Especially a major version was changed that every time will occur some error after installed. This time I  upgrade it from 15.7.x to 15.8.4.As expected all of my projects cannot be loaded. Workaground According to the message I head to the developer forum where I found the answer as below: 1. Run as administrator to open Developer Command. 2.Enter the following commands. gacutil /i "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Build.Framework.dll" gacutil /i "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Build.dll" gacutil /i "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Build.Engine.dll" gacutil /i "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Build.Conversion.Core.dll" gacutil /i "C:\Pro

SQL Server pass parameter to Procedure

Today, My colleague mention his work which how to pass the parameter to the procedure. The workaround as below: 1.Declare a custom table type CREATE   TYPE   dbo . USER_TABLE_TYPE  AS   TABLE   (        USER_NO   VARCHAR ( 8 ) ) 2.C# Declare DataTable and SqlParameter      var   table =   new   DataTable();             table.Columns.Add( new   DataColumn( "USER_NO" , System.Type.GetType( "System.String" )));             table.Rows.Add(table.NewRow());             table.Rows[0][ "USER_NO" ] =   "Abc" ;               var   par =   new   SqlParameter             {                 ParameterName =   "userTable" ,                 Value = table,                 SqlDbType = SqlDbType.Structured,                 TypeName =   "dbo.USER_TABLE_TYPE"             }; 3.Declare parameter which type is just created CREATE   PROCEDURE   dbo . GetUsers        @userTable USER_TABLE_TYPE  READONLY

IIS Block IP Setting

Image
We have two Web Server one for internal another for external. Now we consider let two into one. The main site will be opened a limited specific IP range, but some of the other sites will be opened to the public. How to 1.Add Features- IP and Domain Restriction After installed, It will show the icon in the root or subsites. 2.Setting IIS Root access from Allow to Deny. 3.IIS Root against specific IP range to open.e.g.The mask of the example as 255.255.255.0 it means from192.168.2.0~255 can be accessed. 4.Opening to the public by specific sites. Due to IIS Root has setting the deny. All of the sites will inherit this setting. After subsite modify its settings then it will base on a subsite. Therefore, it can be satisfied our request the deny is default but some allow. All of the settings are stored in the IIS config file. %windir%\System32\inetsrv\config\applicationHost.config Above-mentioned, all of the settings processes also can be execute

Jenkins- PowerShell include global config

Image
We have a PowerShell-script that will be referenced in many jobs at Jenkins.e.g. Retrieving a DataTable from the database. It will hard to maintain if this script in individual jobs. For this issue, I found a plugin can solve it How to setup 1.Install plugin-Managed Scripts 2.Jenkins Management,Enter the link of Managed files. 3.Add a new Config Name:For identification。 Content:Execute Script Way to use 1.Including the config which we just add it before.,Target:Output folder 2.Executing Power Shell Import-Module the config file in the output folder and call its function to get the count of records by SQL Reference Managed Script Plugin https://wiki.jenkins.io/display/JENKINS/Managed+Script+Plugin Power Shell Sql Query http://mattslay.com/sql-server-queries-using-powershell-lesson-1/

VS2017-Build fail-FindDependenciesOfExternallyResolvedReferences

Image
Recently, After installed the newest version of Visual Studio 2017 that occurred some of the following error messages: Software Infomation:Visual Studio 2017 Enterprise 15.7.4  (The problem since 15.6.x) Workaround I asked the help from forums the got temporary workaround as below: Opening file: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets Finding the red block highlight at below photo then remove it from the file. Reference https://developercommunity.visualstudio.com/content/problem/208668/the-finddependenciesofexternallyresolvedreferences.html