1

How can I create makefile for a c# project? Or, how can I compile my project from the command line?

The project name is Ex6-Assembler and the cs files are: main.cs, code.cs, SymbolTable.cs, parser.cs

Divi
  • 7,621
  • 13
  • 47
  • 63
Michael A
  • 5,770
  • 16
  • 75
  • 127
  • Have a look here: http://stackoverflow.com/questions/498106/how-do-i-compile-a-visual-studio-project-from-the-command-line – Adrian Fâciu Mar 30 '11 at 11:45

3 Answers3

4

For 'make'-alternative you can use MSBuild, you can read about it here Or if you want, you can just compile files, calling csc.exe as described here

ionoy
  • 975
  • 6
  • 19
  • csc.exe? where should i write it? in what folder should i be (in commnand prompt) whem i try it it shows error message "command is not recognizable... – Michael A Mar 30 '11 at 11:50
  • Go to your Visual Studio Bin folder, on my machine it's "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\" and run VCVARS32.bat file. It will pop up Command Prompt with appropriate folders added to PATH. – ionoy Mar 30 '11 at 12:10
3

look there for build your application via commandline: https://msmvps.com/blogs/luisabreu/archive/2007/08/31/compiling-c-code-from-de-code-line.aspx

here is the offical msdn page to this topic: http://msdn.microsoft.com/en-us/library/78f4aasd%28v=vs.80%29.aspx

you can find more details on the msdn:

http://msdn.microsoft.com/en-us/library/1700bbwd%28v=vs.71%29.aspx

Fender
  • 3,055
  • 1
  • 17
  • 25
2

i am use run_built.bat file there are code

C:\windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe /target:Build build.msbuild
PAUSE

and build.msbuild:

<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <Target Name="Build">
        <MSBuild Projects="MyProject.sln" Targets="Rebuild" Properties="Configuration=Release;" />
    </Target>
</Project>
Andrei Andrushkevich
  • 9,905
  • 4
  • 31
  • 42