简体   繁体   English

使用c#Process.Start()打开Visual Studio项目

[英]Open Visual Studio project using c# Process.Start()

In my situation, I have a zip file which contains Visual Studio Project (the csproj file, bin and obj folder,...). 在我的情况下,我有一个包含Visual Studio Project的zip文件(csproj文件,bin和obj文件夹,...)。 This zip is exported from a database and unzipped in custom temporaly directory using .NET C#. 此zip从数据库导出,并使用.NET C#解压缩到自定义的临时目录中。 The problem appears when I start the csproj file using Process.Start() method. 使用Process.Start()方法启动csproj文件时出现问题。 VS loads the project but the project files are not found and are marked with exclamation mark. VS加载了项目,但是找不到项目文件,并在文件中标有感叹号。 After I checked, it appeared that the csproj file is loaded from the default Temporaly Internet Files folder. 检查后,似乎从默认的Temporaly Internet Files文件夹加载了csproj文件。 If I open Windows Explorer and go to my custom directory and double_click the file, the project is loaded correctly. 如果我打开Windows资源管理器并转到自定义目录并双击该文件,则将正确加载该项目。 Does anyone know how can I tell Visual Studio to load my project using C# code? 有谁知道我该如何告诉Visual Studio使用C#代码加载项目?

It looks like you need to specify the correct working directory for the Process.Start() command. 看起来您需要为Process.Start()命令指定正确的工作目录。

I believe this question will help you out with this: Open Program from C# - also specifying the working directory 我相信这个问题将帮助您解决这个问题: 从C#打开程序-还指定工作目录

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM