Click here to Skip to main content
15,919,931 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Friends,


I'm trying to compile .cs file from one location and generate its .exe file at other location. Compilation is done but the .exe file is not generating at the desired location.

At windows command Prompt

C:\Windows\Microsoft.NET\Framework\v3.5>csc "d:\abc.cs"

this works fine.

But when i try to generate its .exe file at d or e drive it does not generate. Instead I'm able to generate .exe file in the same directory where from I'm running csc compiler i.e. C:\Windows\Microsoft.NET\Framework\v3.5

I have also tried
C#
C:\Windows\Microsoft.NET\Framework\v3.5>abc /out:d:\

but it is still creating abc.exe file at the location C:\Windows\Microsoft.NET\Framework\v3.5 instead of d or e drive

Please guide me what can i do here.
Posted

For me
C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe /out:f:\temp\x.exe Test.cs  

is working just fine, the file is created where it should be.
Consult: http://msdn.microsoft.com/en-us/library/78f4aasd.aspx[^]
 
Share this answer
 
I got the solution here

syntax:
csc /out:"<drive>:\<directory if any>\<filename>.exe" 
"<drive>:\<directory if any>\<filename>.cs"


C#
csc /out:"e:\abc.exe" "d:\abc.cs"


However you can change the .exe name
C#
csc /out:"e:\myFile.exe" "d:\abc.cs"



Thanks to everyone to put your time on this query.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900