.NET Core 프로젝트로 마이그레이션 시 "CS0579 Duplicate 'System.Reflection.AssemblyCompanyAttribute' attribute" 오류 발생
기존 .NET Framework 대상 프로젝트를 .NET Core로 마이그레이션 시 다음과 같은 오류가 발생할 수 있습니다.
CS0579 Duplicate 'System.Reflection.AssemblyCompanyAttribute' attribute
CS0579 Duplicate 'System.Reflection.AssemblyConfigurationAttribute' attribute
CS0579 Duplicate 'System.Reflection.AssemblyFileVersionAttribute' attribute
CS0579 Duplicate 'System.Reflection.AssemblyProductAttribute' attribute
CS0579 Duplicate 'System.Reflection.AssemblyTitleAttribute' attribute
CS0579 Duplicate 'System.Reflection.AssemblyVersionAttribute' attribute
일단 원인 설명은 간단합니다. 기존 프로젝트의 "Properties" 폴더에 AssemblyInfo.cs 파일이 있는 데다, 기본적으로 .NET Core는 빌드 과정 중에 \obj\Debug에도 프로젝트 정보를 기반으로 AssemblyInfo.cs 파일을 자동 생성하기 때문입니다.
자세한 사항은 다음의 글에 나옵니다.
Duplicate 'System.Reflection.AssemblyCompanyAttribute' attribute
; https://github.com/dotnet/cli/issues/4710
따라서 해결 방법은 2가지입니다. 기존 프로젝트의 AssemblyInfo.cs를 지우던가, 아니면 자동으로 AssemblyInfo.cs 파일을 생성하지 못하도록 하는 것입니다. 우선, 후자의 방법은 다음의 설정을 csproj에 추가함으로써 가능합니다.
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
그런데, 위의 옵션은 초기 .NET Core 버전에만 적용되고 이후에는 다음의 옵션으로 바뀌었다고 합니다.
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
반면, 전자의 방법으로 기존 프로젝트의 AssemblyInfo.cs를 지우는 것도 가능한데요. 이럴 때는 자동 생성되는 AssemblyInfo.cs의 속성 값을 바꾸기 위해 마찬가지로 csproj에 다음과 같은 대응 속성을 설정하면 됩니다.
<Company>TestCorp</Company>
위의 Company 속성은 AssemblyCompanyAttribute에 대응해서 자동 생성된 AssemblyInfo.cs에 업데이트가 됩니다.
[assembly: System.Reflection.AssemblyCompanyAttribute("TestCorp")]
[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]
No | Writer | Date | Cnt. | Title | File(s) |
11895 | 정성태 | 5/12/2019 | 876 | .NET Framework: 832. ML.NET Model Builder - 회귀(Regression), 다중 분류(Multi-class classification) 예제 | 1 |
11894 | 정성태 | 5/12/2019 | 1185 | VS.NET IDE: 135. Visual Studio - ML.NET Model Builder 소개 [1] | |
11893 | 정성태 | 5/10/2019 | 845 | 오류 유형: 535. C# 6.0 이상의 문법을 컴파일 시 오류가 발생한다면? | |
11892 | 정성태 | 5/10/2019 | 645 | 웹: 38. HTTP Cookie의 expires 시간 형식(RFC7231) | |
11891 | 정성태 | 5/9/2019 | 816 | .NET Framework: 831. (번역글) .NET Internals Cookbook Part 12 - Memory structure, attributes, handles | |
11890 | 정성태 | 5/8/2019 | 650 | 개발 환경 구성: 439. "Visual Studio Enterprise is required to execute the test." 메시지와 관련된 코드 기록 | |
11889 | 정성태 | 5/8/2019 | 672 | 개발 환경 구성: 438. mstest, QTAgent의 로그 파일 설정 방법 | |
11888 | 정성태 | 5/8/2019 | 935 | .NET Framework: 830. C# - 비동기 호출을 취소하는 CancellationToken의 간단한 예제 코드 | 1 |
11887 | 정성태 | 5/8/2019 | 917 | .NET Framework: 829. C# - yield 문을 사용할 수 있는 메서드의 조건 | |
11886 | 정성태 | 5/8/2019 | 925 | 오류 유형: 534. mstest.exe 실행 시 "Visual Studio Enterprise is required to execute the test." 오류 [2] | |
11885 | 정성태 | 5/7/2019 | 517 | 오류 유형: 533. mstest.exe 실행 시 "File extension specified '.loadtest' is not a valid test extension." 오류 발생 | |
11884 | 정성태 | 5/5/2019 | 964 | .NET Framework: 828. C# DLL에서 Win32 C/C++처럼 dllexport 함수를 제공하는 방법 - 두 번째 이야기 | |
11883 | 정성태 | 5/3/2019 | 1049 | .NET Framework: 827. C# - 인터넷 시간 서버로부터 받은 시간을 윈도우에 적용하는 방법 | 1 |
11882 | 정성태 | 5/9/2019 | 695 | .NET Framework: 826. (번역글) .NET Internals Cookbook Part 11 - Various C# riddles | 1 |
11881 | 정성태 | 4/28/2019 | 960 | 오류 유형: 532. .NET Core 프로젝트로 마이그레이션 시 "CS0579 Duplicate 'System.Reflection.AssemblyCompanyAttribute' attribute" 오류 발생 | |
11880 | 정성태 | 4/25/2019 | 601 | 오류 유형: 531. 이벤트 로그 오류 - Task Scheduling Error: m->NextScheduledSPRetry 1547, m->NextScheduledEvent 1547 | |
11879 | 정성태 | 10/21/2019 | 788 | .NET Framework: 825. (번역글) .NET Internals Cookbook Part 10 - Threads, Tasks, asynchronous code and others | 1 |
11878 | 정성태 | 5/9/2019 | 778 | .NET Framework: 824. (번역글) .NET Internals Cookbook Part 9 - Finalizers, queues, card tables and other GC stuff | 1 |
11877 | 정성태 | 5/9/2019 | 769 | .NET Framework: 823. (번역글) .NET Internals Cookbook Part 8 - C# gotchas | 1 |
11876 | 정성태 | 5/9/2019 | 674 | .NET Framework: 822. (번역글) .NET Internals Cookbook Part 7 - Word tearing, locking and others | 1 |
11875 | 정성태 | 4/21/2019 | 560 | 오류 유형: 530. Visual Studo에서 .NET Core 프로젝트를 열 때 "One or more errors occurred." 오류 발생 | |
11874 | 정성태 | 5/9/2019 | 670 | .NET Framework: 821. (번역글) .NET Internals Cookbook Part 6 - Object internals | 1 |
11873 | 정성태 | 5/9/2019 | 625 | .NET Framework: 820. (번역글) .NET Internals Cookbook Part 5 - Methods, parameters, modifiers | 1 |
11872 | 정성태 | 5/9/2019 | 807 | .NET Framework: 819. (번역글) .NET Internals Cookbook Part 4 - Type members | 1 |
11871 | 정성태 | 5/9/2019 | 860 | .NET Framework: 818. (번역글) .NET Internals Cookbook Part 3 - Initialization tricks [3] | 1 |
11870 | 정성태 | 4/16/2019 | 756 | .NET Framework: 817. Process.Start로 실행한 콘솔 프로그램의 출력 결과를 얻는 방법 | 1 |