Visual Studio

H

HELLO $$$

To those who are familiar to MS Visual studio :
I have recently Visual Studio 2005.
Please can any body tells me , when I write a code:
How can I separate the files of such code from the Studio program and
operate it away from mother program (Studio).
Thank you.
=============================
 
P

pvdg42

HELLO $$$ said:
To those who are familiar to MS Visual studio :
I have recently Visual Studio 2005.
Please can any body tells me , when I write a code:
How can I separate the files of such code from the Studio program and
operate it away from mother program (Studio).
Thank you.
=============================
Are you talking about deploying a completed project to other computers for
use?
If so, please see Setup and Deployment under "Other Project Types" in the
New Project dialog.
You may also want to research "Xcopy deployment".

http://msdn2.microsoft.com/en-us/library/wx3b589t.aspx

http://msdn2.microsoft.com/en-us/library/54cw8ks0.aspx
 
M

Morten Wennevik

If you mean how to start your programs outside visual studio, then locate
your executable and run it from disk.
It will be located where you have your project (which is under My
Documents\Visual Studio 2005\Projects if you created the project in its
default location). Inside your project directory browse to bin\debug or
bin\release. You should find a .exe-file that you can run directly.
 
H

HELLO $$$

When I write a code I usually save it on the root of "c", to be easily
identified. The code written usually contain many files (one of them has
..exe)on the root of C. I did a copy to these files on a disk.Then every time
Itry to operate such code(by clicking the .exe) the program does not
operate, or shows the black background output and I read "click any key to
continue". When I do so everything disappears as if nothing happened !!!!
Are there something in customizing the program or other thing I must do???!
Thanks
++++++++++++++++++++++++++++++++

If you mean how to start your programs outside visual studio, then locate
your executable and run it from disk.
It will be located where you have your project (which is under My
Documents\Visual Studio 2005\Projects if you created the project in its
default location). Inside your project directory browse to bin\debug or
bin\release. You should find a .exe-file that you can run directly.
 
M

Morten Wennevik

The compiled executable should be found in <project folder>\bin\debug or
<project folder>\bin\release

What do you mean by the program does not operate? "Click any key to
continue" is added by Visual Studio if you run the program using Ctrl+F5
(Start without debugging) and is not part of the actual program.

Try using this code to test your program. It will write Hello World to
the screen and then wait for a key press.

static void Main()
{
System.Console.WriteLine("Hello World");
System.Console.ReadKey();
}
 
H

HELLO $$$

Please write the code complete and tell me what's type oof template I
choose.
Thank you Morten.
=============================
The compiled executable should be found in <project folder>\bin\debug or
<project folder>\bin\release

What do you mean by the program does not operate? "Click any key to
continue" is added by Visual Studio if you run the program using Ctrl+F5
(Start without debugging) and is not part of the actual program.

Try using this code to test your program. It will write Hello World to
the screen and then wait for a key press.

static void Main()
{
System.Console.WriteLine("Hello World");
System.Console.ReadKey();
}
 
M

Morten Wennevik

Creating a new project (File->New->Project), calling the application
ConsoleApplication2 and using C:\Projects\2.0 as the project base folder.
Select C#->Windows->Console application as the teamplate. You should end
up with a code file called Program.cs containing this piece of code

using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
}
}
}

Add the following two lines making Program.cs look like this

using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World");
Console.ReadKey();
}
}
}

Hit F5 to run the program and verify that you get a black window with
"Hello World" written in it, and that the window closes when you hit a
(regular) key.

If I open an explorer window and browse to
C:\Projects\2.0\ConsoleApplication2 I will find another
ConsoleApplication2 folder and two files which stores the location of
other project files etc used by Visual Studio.

Browsing to this folder I will find ConsoleApplication2.exe which is the
name of my project + .exe. This is the compiled program. You can change
the name for the output file in visual studio if you like, or just rename
the file later on. This file can be copied anywhere, sent to friends etc.

The other .exe file ConsoleApplication2.vshost.exe is a Visual Studio file
and can be ignored.

The ConsoleApplication2.pdb is a debug information file. This will give
filename information and line numbers in case of an error. For instance,
if you change Main to the code below you can try running the file from a
command prompt (or else you won't have time to see the error before the
window closes) before and after deleting the pdb file (don't worry about
deleting the file, it will be recreated next time you compile your program
in visual studio).

static void Main(string[] args)
{
throw new InvalidProgramException("Help!");
}

The result should be like this with the pdb-file present

Unhandled Exception: System.InvalidProgramException: Help!
at ConsoleApplication2.Program.Main(String[] args) in
C:\Projects\2.0\Console
Application2\ConsoleApplication2\Program.cs:line 11

Without the pdb-file

Unhandled Exception: System.InvalidProgramException: Help!
at ConsoleApplication2.Program.Main(String[] args)
 
H

HELLO $$$

Hi Mortin, Idid all but theseerrors appeared.
By the way I am beginner studying C++.
Errors are:
Error 1 A using clause must precede all other namespace elements except
extern alias declarations
C:\ConsoleApplication2\ConsoleApplication2\Program.cs 14 1
ConsoleApplication2
Error 2 A using clause must precede all other namespace elements except
extern alias declarations
C:\ConsoleApplication2\ConsoleApplication2\Program.cs 15 1
ConsoleApplication2
Error 3 A using clause must precede all other namespace elements except
extern alias declarations
C:\ConsoleApplication2\ConsoleApplication2\Program.cs 16 1
ConsoleApplication2
=================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top