I need to create a script that produces an executable from a C# console project.
The client system where the script will be run doesn't have Visual Studio, but it has the .NET framework installed. How can it be done using a minimum or no software installation at the client place?
Does the C# compiler (csc.exe) come with .NET framework? If so, is there an environment variable for the location?
If you have a project ready and just want to change some code and then build, check out MSBuild which is located in the Microsoft.Net
folder under the Windows
directory.
C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild "C:\Projects\MyProject.csproj" /p:Configuration=Debug;DeployOnBuild=True;PackageAsSingleFile=False;outdir=C:\Projects\MyProjects\Publish\
(Please do not edit, leave as a single line)
... The line above broken up for readability
C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild "C:\Projects\MyProject.csproj"
/p:Configuration=Debug;DeployOnBuild=True;PackageAsSingleFile=False;
outdir=C:\Projects\MyProjects\Publish\
How to determine which versions and service pack levels of the Microsoft .NET Framework are installed
If you're a Grandma, this is easily:
-- Create a .bat
file with this:
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\csc.exe csharp.cs
csharp.exe
-- Create a .cs
file with this:
class Program
{
public static void Main()
{
System.Console.Clear();
//code...
System.Console.WriteLine("Congratulation! =D");
//...code
System.Console.ReadKey();
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With