visual-studio

How to use Add-Migration if the project contains multiple folders

佐手、 提交于 2021-02-10 06:17:15
问题 I would like to Add-Migration with my DbContext, but I get Error: The term 'add-migration' is not recognized as the name of a cmdlet, function, script file, or operable program. Is the problem related with folder structure? The customized User.cs, Role.cs and the Startup.cs are in different folders. The Entity Framework is included in the DbContext project file. How do I fix this? 回答1: Is the problem related with folder structure? This issue is not about the folder structure .It's about the

How to open Arabic text file with correct encoding in Visual Studio

霸气de小男生 提交于 2021-02-10 06:08:12
问题 I have a C# file that has some arabic text in it, I got the file from another source, the arabic text is now scrambled. looking like this ("ÇáãæÇÞÚ ÇáÞÇÈáÉ ááÊØæíÑ ÇáÓíÇÍì"), I tried to save the file in another encoding (UTF-8) but still same result, I desperately need to read this arabic text as this is the only back up we have Thanks 回答1: Try right-clicking the file in VS solution explorer, then choose: Open With... -> CSharp Editor with Encoding This should force VS to read the file with a

How to open Arabic text file with correct encoding in Visual Studio

耗尽温柔 提交于 2021-02-10 06:07:16
问题 I have a C# file that has some arabic text in it, I got the file from another source, the arabic text is now scrambled. looking like this ("ÇáãæÇÞÚ ÇáÞÇÈáÉ ááÊØæíÑ ÇáÓíÇÍì"), I tried to save the file in another encoding (UTF-8) but still same result, I desperately need to read this arabic text as this is the only back up we have Thanks 回答1: Try right-clicking the file in VS solution explorer, then choose: Open With... -> CSharp Editor with Encoding This should force VS to read the file with a

.NETStandard multi-targeting library packages do not get restored when building

こ雲淡風輕ζ 提交于 2021-02-10 05:44:15
问题 Background: I have created a multi-targeting library that targets net40 , net462 , and netstandard2.0 . The purpose of this library is to wrap StackExchange.Redis and some related reconnect logic. For net40 I need to use an older version of the package than the newer targets. Here is my csproj file: <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFrameworks>net40;net462;netstandard2.0</TargetFrameworks> </PropertyGroup> <ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">

Build project targeting for both x86 and x64 platform

心已入冬 提交于 2021-02-10 05:42:27
问题 In my solution, there is a class library which is an excel add-in. When I build the solution or that project, I want this project will be built firstly targeting for x86 with outputing a file named xxx.dll , and then targeting for x64 with outputing a file named xxx_x64.dll . How should I do for this, or how could I edit the csproj file? Thanks. 回答1: How should I do for this, or how could I edit the csproj file? The name of assembly xxx.dll is defined by the property AssemblyName in the

Visual Studio 2019 - error MSB8020: The build tools for Visual Studio 2013 cannot be found

心不动则不痛 提交于 2021-02-10 03:12:56
问题 This is the GitHub page where I'm trying to use msbuild.exe only it's throwing this following error: 1>------ Build started: Project: keycastow, Configuration: Debug|Win32 ------ C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(379,5): error MSB8020: The build tools for Visual Studio 2013 (Platform Toolset = 'v120') cannot be found. To build using the v120 build tools, please install Visual Studio 2013 build tools.

ASP.NET Core (.NET 5) + Angular 11 = build error on empty project

假装没事ソ 提交于 2021-02-10 02:49:31
问题 If I create a new ASP.NET Core Web API + Angular project in Visual Studio using: dotnet new angular , it creates a .NET 5 project containing in the ClientApp a new Angular 8.2 project. If I F5 it, everything works perfectly. But I want to use and Angular 11 project, so i wipe the ClientApp content, open a terminal there and: ng new <app-name> --directory ./ there. Project created, F5 , the project launches but at every launch these 2 lines appear in the Debug Console: Microsoft.AspNetCore

Unhandled exception in VS extension

非 Y 不嫁゛ 提交于 2021-02-09 11:45:09
问题 I have tried creating a syntax highlighter for a custom file definition. I get an exception when its loaded. I have added the /log parameter to devenv to get a log. 335 ERROR System.Exception: Duplicate EditorFormatDefinition exports with identical NameAttribute metadata exist. Duplicate name attribute is COMMENT Editor or Editor Extension 2010/08/18 06:47:56.726 336 ERROR System.Exception: Duplicate EditorFormatDefinition exports with identical NameAttribute metadata exist. Duplicate name

Insert command works without errors in C# but data is not inserted to the MS SQL Server

我怕爱的太早我们不能终老 提交于 2021-02-09 11:30:28
问题 I am trying to insert data into Microsoft SQL Server DB using C# and the insert command works well and I get no errors or exceptions. But when I check my database in SQL Server there is no effect on the table and the records are not inserted into the table. This is the code that I try: try { SqlConnection con1 = new SqlConnection(); con1.ConnectionString = "Server = (local); Database = My_DataBase; Integrated Security = true"; con1.Open(); SqlCommand cm1 = new SqlCommand(); cm1.Connection =

Visual Studio 2017 Cannot Modify - Restart Required

橙三吉。 提交于 2021-02-09 02:48:56
问题 I have been trying to update and modify my Visual Studio 2017 for 2 days now, but each time I run the Visual Studio Installer, I get this message: "A restart is required. If needed, any remaining setup will resume after the restart." Obviously I restarted about 10 times... Any idea what I must delete where to get rid of any temp garbage that is hindering my attempts to modify my installation? 回答1: I encountered the same issue while installing Visual Studio 2019. I tried the PowerShell script