In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article shows you how to compile another program in the C# program. The content is concise and easy to understand, which will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
1. Before compiling a C# program, you need to use a compilation tool devenv.exe provided by VS2005. You can use the console command in the VS installation directory\ Common7\ IDE:
Devenv / rebuild debug "[sln path]"
2. C # program compiles to run the specified program in the code, you can use the process method:
Using System.Diagnostics System.Diagnostics.Process.StartInfo info=new StartInfo (); info.FileName= "specific programs you want to use"; Info.Arguments= "files to open:; System.Diagnostics.Process.Start (info)
3. A problem will be encountered in the actual use of C # program compilation: if each person's VS installation directory is different, the path to call devenv in the program is different. The way to solve this problem is to read the ApplicationPath key value of vs in the registry (which was described earlier). To sum up, the implementation is as follows:
Using System.Diagnostics; using Microsoft.Win32; private const string REGISTKEY = "SOFTWARE\\ Microsoft\ MSEnvCommunityContent\\ ContentTypes\ Addin\\ ContentHosts\\ 1.0\ Visual Studio 2005"; RegistryKey rkey = Registry.LocalMachine; / / The second parameter tells it to open the key as writable RegistryKey rkey1 = rkey.OpenSubKey (REGISTKEY, true); string visualStudio8Path = rkey1.GetValue ("ApplicationPath"). ToString (); ProcessStartInfo startInfo = new ProcessStartInfo (visualStudio8Path) StartInfo.Arguments = "/ rebuild debug" + "[sln path]"; Process process = new Process (); process.StartInfo = startInfo; process.Start (); process.WaitForExit (); the above is how to compile another program in the C # program. Have you learned the knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.