.NET核心和VSCode无法创建项目 - 命令行错误
我下载了VSCode和.NET CORE.zip以探索ASP5。我在工作计算机上,没有管理员权限。所以我解压缩.NET CORE文件夹并将其放置在桌面上的个人文件夹中。 C:\Users\(my.name)\Desktop\Me\dotnetcore
。 .NET核心和VSCode无法创建项目 - 命令行错误
然后我进入我的环境变量为我的用户,并将其添加到我的Path
变量。
现在我打开VSCode并为项目创建了一个新文件夹。这是在同一个桌面文件夹作为我的.NET核心“安装项目的文件夹。
现在,让我们尝试做一个新ASP5 MVC Web应用程序!根据文件,该命令应该是这样.. dotnet new mvc -au None -f netcoreapp1.0
,所以让在VSCode终端运行它..等等......什么?!
如果有人可以帮助我在这里,这将是美妙的:)预先感谢您的时间。
而且,如果我打开一个标准的Windows命令行并运行dotnet
,它似乎能正常工作,如图所示...
P.S我想我没有编辑我的名字了最后两个screenies,不是一个相关的点,只是有点滑稽,我想大声笑。
我一直无法重现您的问题。有我采取的步骤。
Download the Windows (x64) binaries into C:/temp
。
然后从PowerShell(posh)运行以下命令。如果您不适合posh,则手动执行以下操作是等同的。
# Extract the downloaded zip into the C:\temp\dotnetcore directory.
cd C:\temp
Expand-Archive .\dotnet-dev-win-x64.1.0.1.zip
New-Item -Type Directory dotnetcore
Copy-Item .\dotnet-dev-win-x64.1.0.1\* -Recurse .\dotnetcore\
# Add the dotnetcore directory it to the machine's PATH.
[Environment]::SetEnvironmentVariable
("Path", $env:Path + ";C:\temp\dotnetcore", [System.EnvironmentVariableTarget]::Machine)
# Rename dotnet.exe to my-dotnet.exe instead.
# This step is necessary because I already have dotnet installed.
Rename-Item .\dotnetcore\dotnet.exe my-dotnet.exe
# Create a new directory, in which to create MyApp.
New-Item -type Directory MyApp
做完这一切,打开Visual Studio代码在C:\ TEMP \ MyApp的目录并运行从集成CMD终端my-dotnet new mvc -au None -f netcoreapp1.0
。
如果我是你,我会尝试上述步骤,看看你是否有一个不同的结果比我有。
嗯,在你的终端VSCode它说你的命令行是cmd,而我的说powershell ..我会尝试解开通过posh – KeplerIO
解包@KeplerIO集成终端外壳是可配置的。我在这个答案中选择了cmd,因为我想在用posh修改它之后加载PATH变量。现在我知道你在使用posh了,我可以给你额外的豪华相关综合终端提示。 –
@downvoter关注意见? –
.NET Core CLI不接受我键入命令的语法。这是BS,因为我从文档中复制了该命令。我试图运行的命令的版本是dotnet new mvc --auth None --framework netcoreapp1.1
,而不是dotnet new mvc -au None -f netcoreapp1.0
。 .NET Core需要重新编写它的CLI。
点网核心体验目前对精确版本非常敏感。 dotnet new mvc -au None -f netcoreapp1.1能更好地工作吗? –
,并忽略VSCode,如果你在控制台中运行整个dotnet新命令而不是? –
非常伤心。因此,完全忽略VSCode并保持命令行。如果你运行'dotnet new mvc -au None -f netcoreapp1.0'(在我的机器上可以正常工作)出现错误,那么你的问题在于dotnet核心安装。 –