나는 Yeoman 발전기를 작성하고 있습니다. 어떻게 전화하면 돼
dotnet new
내 발전기 안에? yeoman generator에서 새로운 .net 코어 프로젝트를 만드는 더 좋은 방법이 있습니까?
한 가지 가능성은 dotnet new
직접 전화 하는 것입니다.
const { execSync, exec } = require('child_process');
function formated_exec_sync(command) {
console.log("exec->" + command);
execSync(command, {stdio: 'inherit'});
}
function new_solution(name) {
formated_exec_sync(`dotnet new sln --name ${name}`);
}
function new_console_project(name) {
formated_exec_sync(`dotnet new console -lang "C#" --name ${name}`);
}
function add_project_to_solution(project_name, solution_name) {
formated_exec_sync(`dotnet sln ${solution_name}.sln add ${project_name}`);
}
function add_package_to_project(package, project, version = null) {
let command = `dotnet add ${project} package`;
if (version != null)
command += ` --version ${version}`;
command += ` ${package}`
formated_exec_sync(command);
}
module.exports = {
new_solution,
new_console_project,
add_project_to_solution,
add_package_to_project,
}
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다