简体   繁体   English

如何使用 c# 获取添加的现有项目的部署版本?

[英]How to get deployment version of added existing project using c#?

I want to get the deployment version from another application if we pass the link of the location of the main project whose dll has this version:如果我们传递dll具有此版本的主项目位置的链接,我想从另一个应用程序获取部署版本:

在此处输入图片说明

How can I do it?我该怎么做?

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.

相关问题 C#如何在最新版本2018.1.1中使用ndepend在项目/解决方案中获取循环方法 - C# How to get the Circular Methods in a Project/Solution using ndepend in the latest version 2018.1.1 如何在Visual Studio 2008部署项目中获取项目的汇编版本 - How to get assembly version of a project in a visual studio 2008 deployment project C# - 项目部署(ClickOnce) - C# - Project Deployment (ClickOnce) 如何获取存储在部署项目中的产品版本号? - How to get the product Version number which is stored in the Deployment Project? c# 如何获取添加的事件? - c# How to get added events? 如何使用 PowerShell 从 C# 获取商店应用程序版本? - How to get store app version from C# using PowerShell? 使用MSBuild Extension Pack和AssemblyInfo自动执行版本号,为什么将其添加到现有项目后会失败? - Using MSBuild Extension Pack and AssemblyInfo to automate the version number, why does it fail when added to an existing project? 如何在 Visual Studio、C# 项目的部署中包含文件和文件夹? - How to include files and folders in the deployment of a visual studio, C# project? 在 c# 中添加现有项目 - Adding existing project in c# 如何在C#中使用自定义用户控件获取项目路径 - How to get path of project using custom user control in c#
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM