We propose a method of constructing a gauge invariant canonical formul
ation for non-gauge classical theory which depends on a set of paramet
ers. Requirement of closure for algebra of operators generating quantu
m gauge transformations leads to restrictions on parameters of the the
ory. This approach is then applied for illustration to bosonic string
theory coupled to background tachyonic field. It is shown that within
the proposed canonical formulation the known mass-shell condition for
tachyon is produced.