[英]How to get deployment version of added existing project using c#?
You can try the following steps to get the deployment version from anther app.您可以尝试以下步骤从另一个应用程序获取部署版本。
First, I make a winform app(named TestWinform) and a console app(named TestConole).首先,我制作了一个 winform 应用程序(名为 TestWinform)和一个控制台应用程序(名为 TestConole)。
Second, I published the console app and set his deployment version is 1.0.0.3
.其次,我发布了控制台应用程序并将他的部署版本设置为
1.0.0.3
。
Third, I add the project TestConsole.application
from path Solutionname\\TestConsole\\bin\\Debug
into the winform app.(Adding existing project)第三,我将路径
Solutionname\\TestConsole\\bin\\Debug
的项目TestConsole.application
添加到winform 应用程序中。(添加现有项目)
Fourth, I write the following code in the winform app.四、我在winform app中编写如下代码。
private void button1_Click(object sender, EventArgs e)
{
DataSet ds = new DataSet();
ds.ReadXml(Path.Combine(Environment.CurrentDirectory, @"../../TestConsole.application"));
DataTable dt = new DataTable();
if (ds.Tables.Count > 1)
{
dt = ds.Tables[1];
MessageBox.Show(dt.Rows[0]["version"].ToString());
}
}
Finally, I get the version.最后,我得到了版本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.