在命令提示符,csc不能使用,怎么办?

找到一个路径,"C:\Windows\Microsoft.NET\Framework64\v4.0.30319",将此路径添加到环境变量。

在Windows 11里,Setting--About--Advanced System Settings--Environment Variables,双击Path。

PS C:\Users\a-xiaobodou\> csc
Microsoft (R) Visual C# Compiler version 4.8.9032.0
for C# 5
Copyright (C) Microsoft Corporation. All rights reserved.

This compiler is provided as part of the Microsoft (R) .NET Framework, but only supports language versions up to C# 5, which is no longer the latest version. For compilers that support newer versions of the C# programming language, see http://go.microsoft.com/fwlink/?LinkID=533240

warning CS2008: No source files specified
error CS1562: Outputs without source must have the /out option specified

PS C:\Users\a-xiaobodou\OneDrive - Microsoft\Projects\C#\csharpmagic\第2章> csc StringFormatDemo.cs
Microsoft (R) Visual C# Compiler version 4.8.9032.0
for C# 5
Copyright (C) Microsoft Corporation. All rights reserved.

This compiler is provided as part of the Microsoft (R) .NET Framework, but only supports language versions up to C# 5, which is no longer the latest version. For compilers that support newer versions of the C# programming language, see http://go.microsoft.com/fwlink/?LinkID=533240


PS C:\Users\a-xiaobodou\OneDrive - Microsoft\Projects\C#\csharpmagic\第2章> ./StringFormatDemo.exe
当前时间:1/23/2024 2:57:52 PM, 温度是:24.5°C。
当前日期:1/23/2024,时间:2:57 PM
  Year     Population
  2013      1,025,632
  2014      1,105,967
  2015      1,148,203

BeiJing         2024  123,456.00         32.0%
123.46
00123.400
打印大括号用法相同:
 { 和 }
 { 和 }
两个路径是相同的:
c:\china-pub\C#\sample-code
c:\china-pub\C#\sample-code

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值