내 문제는 서로 다른 운영 체제의 텍스트 파일 간의 차이로 인해 발생하는 것 같습니다. 그래서 나는 여기서 행운을 시험해 볼 것이다.
다음에서 생성된 기본 프로젝트를 사용해 보고 싶습니다..NET Core 템플릿 우분투 18.04에서. SQL Server를 설치 mssql-server_15.0.4003.23-3_amd64.deb
하고 버전으로 Express를 선택했습니다. LocalDB는 Windows에서만 사용할 수 있으므로 LocalDB 연결 문자열을 다음 SQL Server 연결 문자열로 바꾸도록 수정해야 할 것 같습니다 src/WebUI/appsettings.json
(올바른지 잘 모르겠습니다).
"ConnectionStrings": {
"DefaultConnection": "Server=localhost\\SQLEXPRESS,1433;Database=ExampleDb;User Id=sa;Password=password;"
},
src/WebUI/
그런 다음 만들기 시작했는데 실패했습니다(아래 참조). 이러한 오류는 연결 문자열에 대한 변경 사항과 관련이 없는 것 같습니다.
첫 번째 오류와 관련하여 src/Domain/Domain.csproj
Emacs를 열었는데 뭔가 이상한 것이 나타났습니다 <U+FEFF>
.https://en.wikipedia.org/wiki/Byte_order_mark바이트 순서에 관한 것입니다. 이 파일이 제대로 작동하도록 하는 방법을 알고 싶습니다.
<U+FEFF>namespace default.Domain.Enums
{
public enum PriorityLevel
{
None,
Low,
Medium,
High
}
}
감사해요.
$ dotnet build
Microsoft (R) Build Engine version 16.4.0+e901037fe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
Restore completed in 147.56 ms for /tmp/test/default/src/Domain/Domain.csproj.
Restore completed in 213.91 ms for /tmp/test/default/src/Application/Application.csproj.
Restore completed in 57.04 ms for /tmp/test/default/src/Infrastructure/Infrastructure.csproj.
Restore completed in 9.65 ms for /tmp/test/default/src/WebUI/WebUI.csproj.
Enums/PriorityLevel.cs(1,11): error CS1001: Identifier expected [/tmp/test/default/src/Domain/Domain.csproj]
Enums/PriorityLevel.cs(1,26): error CS0116: A namespace cannot directly contain members such as fields or methods [/tmp/test/default/src/Domain/Domain.csproj]
Enums/PriorityLevel.cs(1,11): error CS1514: { expected [/tmp/test/default/src/Domain/Domain.csproj]
Enums/PriorityLevel.cs(1,18): error CS1022: Type or namespace definition, or end-of-file expected [/tmp/test/default/src/Domain/Domain.csproj]
Enums/PriorityLevel.cs(2,1): error CS1022: Type or namespace definition, or end-of-file expected [/tmp/test/default/src/Domain/Domain.csproj]
Exceptions/AdAccountInvalidException.cs(3,11): error CS1001: Identifier expected [/tmp/test/default/src/Domain/Domain.csproj]
Exceptions/AdAccountInvalidException.cs(3,26): error CS0116: A namespace cannot directly contain members such as fields or methods [/tmp/test/default/src/Domain/Domain.csproj]
Exceptions/AdAccountInvalidException.cs(3,11): error CS1514: { expected [/tmp/test/default/src/Domain/Domain.csproj]
Exceptions/AdAccountInvalidException.cs(3,18): error CS1022: Type or namespace definition, or end-of-file expected [/tmp/test/default/src/Domain/Domain.csproj]
Exceptions/AdAccountInvalidException.cs(4,1): error CS1022: Type or namespace definition, or end-of-file expected [/tmp/test/default/src/Domain/Domain.csproj]
ValueObjects/AdAccount.cs(1,7): error CS1001: Identifier expected [/tmp/test/default/src/Domain/Domain.csproj]
ValueObjects/AdAccount.cs(1,7): error CS1002: ; expected [/tmp/test/default/src/Domain/Domain.csproj]
ValueObjects/AdAccount.cs(1,22): error CS0116: A namespace cannot directly contain members such as fields or methods [/tmp/test/default/src/Domain/Domain.csproj]
ValueObjects/AdAccount.cs(1,7): error CS1022: Type or namespace definition, or end-of-file expected [/tmp/test/default/src/Domain/Domain.csproj]
ValueObjects/AdAccount.cs(1,28): error CS1022: Type or namespace definition, or end-of-file expected [/tmp/test/default/src/Domain/Domain.csproj]
ValueObjects/AdAccount.cs(2,7): error CS1001: Identifier expected [/tmp/test/default/src/Domain/Domain.csproj]
ValueObjects/AdAccount.cs(2,7): error CS1002: ; expected [/tmp/test/default/src/Domain/Domain.csproj]
ValueObjects/AdAccount.cs(2,22): error CS0116: A namespace cannot directly contain members such as fields or methods [/tmp/test/default/src/Domain/Domain.csproj]
ValueObjects/AdAccount.cs(2,7): error CS1022: Type or namespace definition, or end-of-file expected [/tmp/test/default/src/Domain/Domain.csproj]
ValueObjects/AdAccount.cs(2,32): error CS1022: Type or namespace definition, or end-of-file expected [/tmp/test/default/src/Domain/Domain.csproj]
ValueObjects/AdAccount.cs(6,11): error CS1001: Identifier expected [/tmp/test/default/src/Domain/Domain.csproj]
ValueObjects/AdAccount.cs(6,26): error CS0116: A namespace cannot directly contain members such as fields or methods [/tmp/test/default/src/Domain/Domain.csproj]
ValueObjects/AdAccount.cs(6,11): error CS1514: { expected [/tmp/test/default/src/Domain/Domain.csproj]
ValueObjects/AdAccount.cs(6,18): error CS1022: Type or namespace definition, or end-of-file expected [/tmp/test/default/src/Domain/Domain.csproj]
ValueObjects/AdAccount.cs(7,1): error CS1022: Type or namespace definition, or end-of-file expected [/tmp/test/default/src/Domain/Domain.csproj]
Common/ValueObject.cs(4,11): error CS1001: Identifier expected [/tmp/test/default/src/Domain/Domain.csproj]
Common/ValueObject.cs(4,26): error CS0116: A namespace cannot directly contain members such as fields or methods [/tmp/test/default/src/Domain/Domain.csproj]
Common/ValueObject.cs(4,11): error CS1514: { expected [/tmp/test/default/src/Domain/Domain.csproj]
Common/ValueObject.cs(4,18): error CS1022: Type or namespace definition, or end-of-file expected [/tmp/test/default/src/Domain/Domain.csproj]
Common/ValueObject.cs(5,1): error CS1022: Type or namespace definition, or end-of-file expected [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoItem.cs(1,7): error CS1001: Identifier expected [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoItem.cs(1,7): error CS1002: ; expected [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoItem.cs(1,22): error CS0116: A namespace cannot directly contain members such as fields or methods [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoItem.cs(1,7): error CS1022: Type or namespace definition, or end-of-file expected [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoItem.cs(1,28): error CS1022: Type or namespace definition, or end-of-file expected [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoItem.cs(2,7): error CS1001: Identifier expected [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoItem.cs(2,7): error CS1002: ; expected [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoItem.cs(2,22): error CS0116: A namespace cannot directly contain members such as fields or methods [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoItem.cs(2,7): error CS1022: Type or namespace definition, or end-of-file expected [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoItem.cs(2,27): error CS1022: Type or namespace definition, or end-of-file expected [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoItem.cs(5,11): error CS1001: Identifier expected [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoItem.cs(5,26): error CS0116: A namespace cannot directly contain members such as fields or methods [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoItem.cs(5,11): error CS1514: { expected [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoItem.cs(5,18): error CS1022: Type or namespace definition, or end-of-file expected [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoItem.cs(6,1): error CS1022: Type or namespace definition, or end-of-file expected [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoList.cs(1,7): error CS1001: Identifier expected [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoList.cs(1,7): error CS1002: ; expected [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoList.cs(1,22): error CS0116: A namespace cannot directly contain members such as fields or methods [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoList.cs(1,7): error CS1022: Type or namespace definition, or end-of-file expected [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoList.cs(1,28): error CS1022: Type or namespace definition, or end-of-file expected [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoList.cs(4,11): error CS1001: Identifier expected [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoList.cs(4,26): error CS0116: A namespace cannot directly contain members such as fields or methods [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoList.cs(4,11): error CS1514: { expected [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoList.cs(4,18): error CS1022: Type or namespace definition, or end-of-file expected [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoList.cs(5,1): error CS1022: Type or namespace definition, or end-of-file expected [/tmp/test/default/src/Domain/Domain.csproj]
Common/AuditableEntity.cs(3,11): error CS1001: Identifier expected [/tmp/test/default/src/Domain/Domain.csproj]
Common/AuditableEntity.cs(3,26): error CS0116: A namespace cannot directly contain members such as fields or methods [/tmp/test/default/src/Domain/Domain.csproj]
Common/AuditableEntity.cs(3,11): error CS1514: { expected [/tmp/test/default/src/Domain/Domain.csproj]
Common/AuditableEntity.cs(3,18): error CS1022: Type or namespace definition, or end-of-file expected [/tmp/test/default/src/Domain/Domain.csproj]
Common/AuditableEntity.cs(4,1): error CS1022: Type or namespace definition, or end-of-file expected [/tmp/test/default/src/Domain/Domain.csproj]
Build FAILED.
Enums/PriorityLevel.cs(1,11): error CS1001: Identifier expected [/tmp/test/default/src/Domain/Domain.csproj]
Enums/PriorityLevel.cs(1,26): error CS0116: A namespace cannot directly contain members such as fields or methods [/tmp/test/default/src/Domain/Domain.csproj]
Enums/PriorityLevel.cs(1,11): error CS1514: { expected [/tmp/test/default/src/Domain/Domain.csproj]
Enums/PriorityLevel.cs(1,18): error CS1022: Type or namespace definition, or end-of-file expected [/tmp/test/default/src/Domain/Domain.csproj]
Enums/PriorityLevel.cs(2,1): error CS1022: Type or namespace definition, or end-of-file expected [/tmp/test/default/src/Domain/Domain.csproj]
Exceptions/AdAccountInvalidException.cs(3,11): error CS1001: Identifier expected [/tmp/test/default/src/Domain/Domain.csproj]
Exceptions/AdAccountInvalidException.cs(3,26): error CS0116: A namespace cannot directly contain members such as fields or methods [/tmp/test/default/src/Domain/Domain.csproj]
Exceptions/AdAccountInvalidException.cs(3,11): error CS1514: { expected [/tmp/test/default/src/Domain/Domain.csproj]
Exceptions/AdAccountInvalidException.cs(3,18): error CS1022: Type or namespace definition, or end-of-file expected [/tmp/test/default/src/Domain/Domain.csproj]
Exceptions/AdAccountInvalidException.cs(4,1): error CS1022: Type or namespace definition, or end-of-file expected [/tmp/test/default/src/Domain/Domain.csproj]
ValueObjects/AdAccount.cs(1,7): error CS1001: Identifier expected [/tmp/test/default/src/Domain/Domain.csproj]
ValueObjects/AdAccount.cs(1,7): error CS1002: ; expected [/tmp/test/default/src/Domain/Domain.csproj]
ValueObjects/AdAccount.cs(1,22): error CS0116: A namespace cannot directly contain members such as fields or methods [/tmp/test/default/src/Domain/Domain.csproj]
ValueObjects/AdAccount.cs(1,7): error CS1022: Type or namespace definition, or end-of-file expected [/tmp/test/default/src/Domain/Domain.csproj]
ValueObjects/AdAccount.cs(1,28): error CS1022: Type or namespace definition, or end-of-file expected [/tmp/test/default/src/Domain/Domain.csproj]
ValueObjects/AdAccount.cs(2,7): error CS1001: Identifier expected [/tmp/test/default/src/Domain/Domain.csproj]
ValueObjects/AdAccount.cs(2,7): error CS1002: ; expected [/tmp/test/default/src/Domain/Domain.csproj]
ValueObjects/AdAccount.cs(2,22): error CS0116: A namespace cannot directly contain members such as fields or methods [/tmp/test/default/src/Domain/Domain.csproj]
ValueObjects/AdAccount.cs(2,7): error CS1022: Type or namespace definition, or end-of-file expected [/tmp/test/default/src/Domain/Domain.csproj]
ValueObjects/AdAccount.cs(2,32): error CS1022: Type or namespace definition, or end-of-file expected [/tmp/test/default/src/Domain/Domain.csproj]
ValueObjects/AdAccount.cs(6,11): error CS1001: Identifier expected [/tmp/test/default/src/Domain/Domain.csproj]
ValueObjects/AdAccount.cs(6,26): error CS0116: A namespace cannot directly contain members such as fields or methods [/tmp/test/default/src/Domain/Domain.csproj]
ValueObjects/AdAccount.cs(6,11): error CS1514: { expected [/tmp/test/default/src/Domain/Domain.csproj]
ValueObjects/AdAccount.cs(6,18): error CS1022: Type or namespace definition, or end-of-file expected [/tmp/test/default/src/Domain/Domain.csproj]
ValueObjects/AdAccount.cs(7,1): error CS1022: Type or namespace definition, or end-of-file expected [/tmp/test/default/src/Domain/Domain.csproj]
Common/ValueObject.cs(4,11): error CS1001: Identifier expected [/tmp/test/default/src/Domain/Domain.csproj]
Common/ValueObject.cs(4,26): error CS0116: A namespace cannot directly contain members such as fields or methods [/tmp/test/default/src/Domain/Domain.csproj]
Common/ValueObject.cs(4,11): error CS1514: { expected [/tmp/test/default/src/Domain/Domain.csproj]
Common/ValueObject.cs(4,18): error CS1022: Type or namespace definition, or end-of-file expected [/tmp/test/default/src/Domain/Domain.csproj]
Common/ValueObject.cs(5,1): error CS1022: Type or namespace definition, or end-of-file expected [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoItem.cs(1,7): error CS1001: Identifier expected [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoItem.cs(1,7): error CS1002: ; expected [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoItem.cs(1,22): error CS0116: A namespace cannot directly contain members such as fields or methods [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoItem.cs(1,7): error CS1022: Type or namespace definition, or end-of-file expected [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoItem.cs(1,28): error CS1022: Type or namespace definition, or end-of-file expected [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoItem.cs(2,7): error CS1001: Identifier expected [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoItem.cs(2,7): error CS1002: ; expected [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoItem.cs(2,22): error CS0116: A namespace cannot directly contain members such as fields or methods [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoItem.cs(2,7): error CS1022: Type or namespace definition, or end-of-file expected [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoItem.cs(2,27): error CS1022: Type or namespace definition, or end-of-file expected [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoItem.cs(5,11): error CS1001: Identifier expected [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoItem.cs(5,26): error CS0116: A namespace cannot directly contain members such as fields or methods [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoItem.cs(5,11): error CS1514: { expected [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoItem.cs(5,18): error CS1022: Type or namespace definition, or end-of-file expected [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoItem.cs(6,1): error CS1022: Type or namespace definition, or end-of-file expected [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoList.cs(1,7): error CS1001: Identifier expected [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoList.cs(1,7): error CS1002: ; expected [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoList.cs(1,22): error CS0116: A namespace cannot directly contain members such as fields or methods [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoList.cs(1,7): error CS1022: Type or namespace definition, or end-of-file expected [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoList.cs(1,28): error CS1022: Type or namespace definition, or end-of-file expected [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoList.cs(4,11): error CS1001: Identifier expected [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoList.cs(4,26): error CS0116: A namespace cannot directly contain members such as fields or methods [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoList.cs(4,11): error CS1514: { expected [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoList.cs(4,18): error CS1022: Type or namespace definition, or end-of-file expected [/tmp/test/default/src/Domain/Domain.csproj]
Entities/TodoList.cs(5,1): error CS1022: Type or namespace definition, or end-of-file expected [/tmp/test/default/src/Domain/Domain.csproj]
Common/AuditableEntity.cs(3,11): error CS1001: Identifier expected [/tmp/test/default/src/Domain/Domain.csproj]
Common/AuditableEntity.cs(3,26): error CS0116: A namespace cannot directly contain members such as fields or methods [/tmp/test/default/src/Domain/Domain.csproj]
Common/AuditableEntity.cs(3,11): error CS1514: { expected [/tmp/test/default/src/Domain/Domain.csproj]
Common/AuditableEntity.cs(3,18): error CS1022: Type or namespace definition, or end-of-file expected [/tmp/test/default/src/Domain/Domain.csproj]
Common/AuditableEntity.cs(4,1): error CS1022: Type or namespace definition, or end-of-file expected [/tmp/test/default/src/Domain/Domain.csproj]
0 Warning(s)
60 Error(s)
答え1
제 생각에는 바이트 순서 표시는 약간 혼란스럽고 현대 컴퓨팅에서는 일반적으로 불필요합니다. 원래 목적은 UTF-16과 UTF-32였으며, 서로 다른 아키텍처의 컴퓨터 간에 상호 교환이 가능하려면 이를 구별할 수 있는 방법이 필요했습니다.리틀 엔디안과 빅 엔디안. 오늘날 UTF-16과 UTF-32는 UTF-8보다 훨씬 덜 인기가 있습니다.필요재료 명세서.
BOM을 언제 사용해야 하는지에 대한 기준은 매우 모호합니다.
67페이지를 참조하세요.http://www.unicode.org/versions/Unicode12.0.0/UnicodeStandard-12.0.pdf
U+FEFF 바이트 순서 표시로 시작하는 데이터 스트림(또는 파일)에는 유니코드 문자가 포함될 수 있습니다. 이 서명은 인코딩된 문자의 형식화되지 않은 데이터 스트림을 보내거나 받는 애플리케이션에 권장됩니다. 다른 신호 방법을 사용하는 경우 서명을 사용하면 안 됩니다.
일반적으로 대부분의 데이터 흐름은 형식화됩니다. 예를 들어 utf-8 구성 파일은 다음과 같습니다.예상되는UTF-8 등의 경우 정의상 "유형이 없는" 것이 아닙니다. 따라서 일반적으로 달리 알지 않는 한 BOM을 포함해서는 안 됩니다.
BOM을 추가하면 BOM을 제거하는 것보다 문제가 발생할 가능성이 더 높습니다. UTF-8은 ASCII와 역호환되도록 설계되었습니다.. 이를 통해 ASCII만 필요한 여러 곳에서 UTF-8을 사용할 수 있습니다. 그러나 BOM은 ASCII의 일부도 아니고 ASCII도 아니며 텍스트 파일을 읽는 많은/대부분의 프로그램이 이를 잘 처리하지 못합니다. 대부분의 사람들은 파일 시작 부분에서 이를 무시하거나 파일을 연결할 때 제거하는 방법을 모릅니다. BOM이 필요한 프로그램은 일반적으로 BOM이 없어도 괜찮습니다.
그러나 많은 텍스트 편집기에서는 사용자에게 알리지 않고 BOM을 추가합니다. 구성 파일을 편집하는 동안 실수로 추가했을 수 있습니다.
BOM을 삭제하는 방법을 직접 묻는 질문도 있습니다. UTF-8 파일에서 BOM을 제거하는 방법은 무엇입니까?
구성 파일에 추가된 BOM을 제거하겠습니다. MS SQL은 이를 기대하지 않습니다.
答え2
이럴 수도 있지
iconv -fUTF16 -tUTF8 file