Any person having a lien by virtue of this chapter may bring an action to enforce the lien in the district court of the county in which the property is situated. Any number of persons claiming liens against the same property may join in the action and when separate actions are commenced the court may consolidate the actions. Before a lienholder may enforce a lien, the lienholder shall give written notice of the lienholder's intention so to do, which notice must be given by personal service upon the legal or equitable owner of the property affected at least ten days before an action to enforce the lien is commenced, or by registered mail directed to the owner's last-known address at least twenty days before the action is commenced. The judgment may direct that if a deficiency remains after the sale of the real property subject to the lien an execution may issue for the deficiency.
N.D.C.C. § 35-27-24