在工作中,我们正在创建一个"遥控器"构建应用程序我的意思是,我们正在开发一个需要使用Visual Studio Express构建另一个应用程序的应用程序。
为此,我们创建了一个托管在IIS上的WCF服务,该服务需要一些参数,然后启动devenev来构建可执行文件并将它们发送给某个客户端。
这样的事情:
public bool Generate(Configuracion configuracion, bool updateSvn, string usuario, string ip, string macAddress, string pcName) {
try {
ExecutionRequestRepository.GetInstance().AddRequest(new Model.ExecutionRequest() {
Date = DateTime.Now,
LoggedUser = usuario,
RequestUserIp = ip,
RequestMacAddress = macAddress,
RequestPcName = pcName,
UpdateFromSvn = updateSvn,
RequestExecName = configuracion.Nombre
});
bool resultado = false;
foreach (Configuracion cfg in GetAll()) {
cfg.Estado = false;
UpdateConfiguracion(cfg);
}
string path = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "App_Data");
string configFilePath = Path.Combine(path, "config", "RutaSolucion.txt");
string solutionContaNet = string.Empty;
TextReader txtReader = new StreamReader(configFilePath);
solutionContaNet = txtReader.ReadLine();
txtReader.Close();
configuracion.Estado = true;
if (UpdateConfiguracion(configuracion)) {
if (File.Exists(Path.Combine(solutionContaNet, "Solucion ContaNet ERP.sln"))) {
string buildCommand = string.Format("/build Release \"{0}\"", Path.Combine(solutionContaNet, "Solucion ContaNet ERP.sln"));
ProcessStartInfo psInfoDevEnv = new ProcessStartInfo();
psInfoDevEnv.FileName = @"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.com";
psInfoDevEnv.Arguments = buildCommand;
psInfoDevEnv.CreateNoWindow = false;
psInfoDevEnv.WindowStyle = ProcessWindowStyle.Maximized;
psInfoDevEnv.RedirectStandardOutput = true;
psInfoDevEnv.UseShellExecute = false;
Process pDevEnv = new Process();
pDevEnv.StartInfo = psInfoDevEnv;
pDevEnv.EnableRaisingEvents = true;
pDevEnv.OutputDataReceived += (sender4, e4) => {
logger.Info(e4.Data);
};
pDevEnv.Exited += (sender3, e3) => {
resultado = true;
};
pDevEnv.Start();
pDevEnv.BeginOutputReadLine();
pDevEnv.WaitForExit();
}
}
return resultado;
}
catch (Win32Exception ex) {
logger.Error(ex.Message, ex);
return false;
}
catch (TargetInvocationException ex) {
logger.Error(ex.Message, ex);
return false;
}
catch (NotImplementedException ex) {
logger.Error(ex.Message, ex);
return false;
}
}
因此,我们发送命令来构建应用程序,但总是收到此消息:
**The Application Data folder for Visual Studio could not be created.**
我不知道如何解决这个问题。