hanumanth

Hi all,

can u plz tell me how to write a c# program to do this..

-> I am having one VC++ application.

-> This vc++ is application contains 2 projects.

-> how to write a c# program to build that VC++ application.

plz give me reply..

Thanks

--hanu




Re: Visual C# Express Edition how to build?

Figo Fei - MSFT

Hi,

Build You mean to call the VC++ resources in C#

Or mean to use VC++ compiler to compile the project

Thanks.






Re: Visual C# Express Edition how to build?

hanumanth9

Hi,

When I run the C# project it means to use VC++ compiler to compile the project.

plz reply..

thank u






Re: Visual C# Express Edition how to build?

Figo Fei - MSFT

Hi,

In C#, you may use System.Diagnostics.Process class to invoke cl.exe.

Sample code:

ProcessStartInfo info = new ProcessStartInfo
(@"C:\Program Files\Microsoft Visual Studio 8\VC\bin\cl.exe", "sourceCode.cpp");

Process.Start(info);

Thanks






Re: Visual C# Express Edition how to build?

hanumanth9

Hi Figo Fei ,

Thanks for ur reply

I got a doubt here..

suppose the VC++ applicaton contains large no of cpp files.. for example(100) then do we need to careate that many processes (or) is there any other solution..

plz reply..

Thanks






Re: Visual C# Express Edition how to build?

Figo Fei - MSFT

Hi,

The idea can be to create threads to do that instead of process. Use lock or sleep of the threads to let them do this work in order to avoid sudden crash.

Thanks






Re: Visual C# Express Edition how to build?

hanumanth9

Hi Figo Fei

Can u give me one example for ur proposed concept.. plz

And I tried for ur previous concept

and I am getting two errors

The code is

using System;

using System.Diagnostics;

using System.ComponentModel;

namespace process

{

class Myprocess

{

void OpenApplication(string myFavoritesPath)

{

Process.Start ("devenv.exe");

Process.Start ("Applicationpath");

}

void ExecuteAppStartInfo()

{

processStartInfo info=new ProcessStartInfo(@"C:\Program Files\Microsoft Visual Studio.NET\VC7\bin\cl.exe", "Applicatiopath");

Process.Start (info);

}

static void Main()

{

string Applicationpath;

Console.WriteLine ( "Enter the path of your Application");

Applicationpath=Console.ReadLine ();

Myprocess p=new Myprocess ();

p.OpenApplication(Applicationpath);

p.ExecuteAppStartInfo();

}

}

}

And the errors are

D:\vcpp\process\Class1.cs(19): The name 'info' does not exist in the class or namespace 'process.Myprocess'
D:\vcpp\process\Class1.cs(18): The type or namespace name 'processStartInfo' could not be found (are you missing a using directive or an assembly reference )
Any thing wrong in my code..

Thanks






Re: Visual C# Express Edition how to build?

hanumanth9

Hi Figo Fei,

If suppose the VC++ application contains several projects and each project contains several cpp files.

then can we write a c# program to devide that appliation into threads without modifing the original VC++ application..

If yes, plz give me one simple example so that I can proceed.

our aim is if we run the C# application it should build the VC++ application.

Plz give reply..

Thanks






Re: Visual C# Express Edition how to build?

Figo Fei - MSFT

Hi,

Error occurred, becuse ProcessStartInfo type is in System.Diagnostics (system.dll) pls check if the reference is added to project right.

About how to use it, you can see the sample in: http://msdn2.microsoft.com/en-us/library/system.diagnostics.processstartinfo.aspx

Thank you






Re: Visual C# Express Edition how to build?

Figo Fei - MSFT

Hi,

Simply compiling work is easy to do.

If you mean to build a complex and huge project, it may be a big question to answer.

Thank you






Re: Visual C# Express Edition how to build?

hanumanth9

Hi,

At present I just want to compile the project..

plz send me a sample code how to compile a VC++ program using C# threads.

Thanks






Re: Visual C# Express Edition how to build?

Figo Fei - MSFT

Hi,

Sorry, to use thread is just an immature idea.

However, compile C++ code with process can be done like:

            Process p = new Process();
            ProcessStartInfo info = new ProcessStartInfo
                ("cmd.exe", @"%comspec% /k ""C:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall.bat"" x86_ia64");
            info.UseShellExecute = false;
            info.RedirectStandardOutput = true;
            info.RedirectStandardInput = true;
            p.StartInfo = info;
            p.Start();
            p.StandardInput.WriteLine("cl.exe d:\\vc.cpp");

Second line is used to execute the batch program to config environment variable (and if you have references in the source code you should add other settings to the info)

Last line is to do the compile work.

But it is just a simple example so far.

Thank you






Re: Visual C# Express Edition how to build?

hanumanth9

Hi,

Actually my Idea why I am asking this thing is..


I have one large VC++ application.
To build that application in single system it will take more time.
So I want to build that application using Grid technology.
So I need to create the VC++ application in to C# threads.
So that each thread will be executed in different systems.
now can u plz tell me how to write a c# program to devide that VC++ application into threads, with out modifying VC++ application.
Now when I run the C# program the VC++ project should compile.
Give me an Idea how to proceed ,means how to compile a VC++ application by writing c# program.

Thanks






Re: Visual C# Express Edition how to build?

Figo Fei - MSFT

Hi, hanumanth9

For this issue I recommend you to use an appropriate newsgroup, potentially one at http://msdn.microsoft.com/newsgroups.

There you may get better answers.

Thank you