嗨,我下载了适用于mac 2017的visual studio社区版。我创建了一个默认的MVC Core 2.0项目,我注意到缺少帐户控制器类,而它过去有注册和帐户其他处理函数。
我在windows .In窗口中创建了相同的项目,可以看到创建了标识类和控制器。
如何在visual studio for mac Core 2.0中生成此身份验证类?
我尝试在windows中创建默认项目并复制到mac,它工作了!在我将连接字符串更改为server.Identity框架后,它在mac中运行良好。但是为什么微软不为mac生成代码呢?
发布于 2017-08-16 00:40:47
好的,这是包含mac ok visual studio 2017 core 2.0认证的命令。
dotnet new mvc -o moviemvc --auth Individual一旦你注册了一个新账号。它将在app.db文件夹中创建一个新的数据库,我相信这是一个文件库数据库。open db使用此sql lite浏览器打开它并查看其中的内容。
如果您希望使用sql server,则需要在使用终端创建新项目时将此代码添加到行中。将它添加到--auth前面就可以了
-uld发布于 2017-08-16 00:00:57
在Windows上使用Visual Studio时,您可以在创建新的ASP.NET核心项目时配置额外的选项。这些额外的配置选项目前在Visual Studio for Mac中不可用,因此创建了一个更简单的ASP.NET核心项目。
因此,您可以像以前一样从Windows复制项目,也可以打开命令提示符并使用dotnet new创建项目。如果运行以下命令,您可以看到可以为ASP.NET核心MVC项目模板指定哪些配置选项:
dotnet new mvc --help发布于 2018-06-02 10:11:48
目前,Mac Visual Studio的GUI不支持添加身份验证功能。然而,CLI做到了!
dotnet new sln --name <filename>- This will create a new sln
- If you don't use the --name flag the sln will take the current folder's name
dotnet new mvc -o moviemvc --auth Individual- This will create a new .csproj with mvc and Authentication (Identity models) included
dotnet sln add </filepath>- This will add the file to the sln in the folder (if exists)
dotnet sln <path-to-solution.sln> add <path-to-project.csproj>- If you have multiple sln's in the folder, you will have to specify the sln you want to target
你也可以在here上找到更多信息
https://stackoverflow.com/questions/45694583
复制相似问题