Microsoft MVP성태의 닷넷 이야기
글쓴 사람
정성태 (techsharer at outlook.com)
홈페이지
첨부 파일
 
(연관된 글이 1개 있습니다.)

Visual Studio 빌드 실패 - The OutputPath property is not set for project

다음과 같은 메시지와 함께 빌드 실패가 난다면?

d:\temp\MyApp\bin>msbuild "..\TestWebApp\TestWebApp.csproj" /property:Platform=x86 /t:Rebuild /property:OutDir=d:\temp\MyApp\bin
Microsoft (R) Build Engine version 4.6.1586.0
[Microsoft .NET Framework, version 4.0.30319.42000]
Copyright (C) Microsoft Corporation. All rights reserved.

Build started 2017-03-14 오후 2:25:56.
The target "MvcBuildViews" listed in a BeforeTargets attribute at "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.Web.Publishing.targets (845,131)" does not exist in the project, and will be ignored.
Project "d:\temp\MyApp\TestWebApp\TestWebApp.csproj" on node 1 (Rebuild target(s)).
Project "d:\temp\MyApp\TestWebApp\TestWebApp.csproj" (1) is building "d:\temp\MyApp\RefObjectLib\RefObjectLib.csproj" (5) on node 1 (Clean target(s)).
Project file contains ToolsVersion="15.0". This toolset may be unknown or missing, in which case you may be able to resolve this by installing the appropriate version of MSBuild, or the build may have been forced to a particular ToolsVersion for policy reasons. Treating the project as if it had ToolsVersion="4.0". For more information, please see http://go.microsoft.com/fwlink/?LinkId=291333.
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(609,5): error : The OutputPath property is not set for project 'RefObjectLib.csproj'.  Please check to make sure that you have specified a valid combination of Configuration and Platform for this project.  Configuration='Debug'  Platform='x86'.  You may be seeing this message because you are trying to build a project without a solution file, and have specified a non-default Configuration or Platform that doesn't exist for this project. [d:\temp\MyApp\RefObjectLib\RefObjectLib.csproj]
Done Building Project "d:\temp\MyApp\RefObjectLib\RefObjectLib.csproj" (Clean target(s)) -- FAILED.

Done Building Project "d:\temp\MyApp\TestWebApp\TestWebApp.csproj" (Rebuild target(s)) -- FAILED.


Build FAILED.

"d:\temp\MyApp\TestWebApp\TestWebApp.csproj" (Rebuild target) (1) ->
"d:\temp\MyApp\RefObjectLib\RefObjectLib.csproj" (Clean target) (5) ->
(_CheckForInvalidConfigurationAndPlatform target) ->
  C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(609,5): error : The OutputPath property is not set for project 'RefObjectLib.csproj'.  Please check to make sure that you have specified a valid combination of Configuration and Platform for this project.  Configuration='Debug'  Platform='x86'.  You may be seeing this message because you are trying to build a project without a solution file, and have specified a non-default Configuration or Platform that doesn't exist for this project. [d:\temp\MyApp\RefObjectLib\RefObjectLib.csproj]

    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.48

오류 메시지를 잘 보시면 그 원인을 알 수 있습니다.

The OutputPath property is not set for project 'RefObjectLib.csproj'. Please check to make sure that you have specified a valid combination of Configuration and Platform for this project. Configuration='Debug' Platform='x86'. You may be seeing this message because you are trying to build a project without a solution file, and have specified a non-default Configuration or Platform that doesn't exist for this project.


그러니까, 위의 상황은 TestWebApp.csproj 프로젝트에서 RefObjectLib.csproj 프로젝트를 참조하고 있는 것입니다. 그렇기 때문에 TestWebApp.csproj를 msbuild로 Rebuild 명령을 내리니 의존 관계에서 따라 RefObjectLib.csproj 프로젝트부터 빌드를 시작한 것입니다.

문제는, RefObjectLib.csproj에 "OutputPath" 속성을 다음 Configuration='Debug' Platform='x86' 빌드 구성이 누락되어 있기 때문에 오류가 발생하였습니다.

실제로 RefObjectLib.csproj 프로젝트를 보면, PropertyGroup으로 "Debug|AnyCPU"와 "Release|AnyCPU"만 있을 뿐 "x86" 구성이 없는 것을 확인할 수 있습니다.

  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>

문제 해결은 간단합니다. RefObjectLib.csproj 파일의 "AnyCPU" 구성 외에 "x86" 구성을 만들어 주면 되는데, 이런 경우 Visual Studio의 "Configuration Manager"에서 할 수도 있지만 다음과 같은 오류 메시지로 추가를 못하는 수가 종종 있습니다.

This platform could not be created because a solution platform of the same name already exists.

당황하지 마시고, 그냥 메모장에서 .csproj 파일을 열고 'Debug|AnyCPU'와 'Release|AnyCPU' 구성을 그대로 복사해서 'x86'으로 만들어 주면 됩니다.

  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <PlatformTarget>x86</PlatformTarget>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <PlatformTarget>x86</PlatformTarget>
  </PropertyGroup>

위의 내용만 추가하고 다시 빌드하면 정상적으로 바이너리가 생성되는 것을 확인할 수 있습니다.




[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]

[연관 글]






[최초 등록일: ]
[최종 수정일: 3/24/2017]

Creative Commons License
이 저작물은 크리에이티브 커먼즈 코리아 저작자표시-비영리-변경금지 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.
by SeongTae Jeong, mailto:techsharer at outlook.com

비밀번호

댓글 작성자
 




... 31  32  33  34  35  36  37  38  39  40  41  42  43  44  [45]  ...
NoWriterDateCnt.TitleFile(s)
12501정성태1/21/20218457.NET Framework: 1015. .NET 5부터 HTTP/1.1, 2.0 선택을 위한 HttpVersionPolicy 동작 방식파일 다운로드1
12500정성태1/21/20219039.NET Framework: 1014. ASP.NET Core(Kestrel)의 HTTP/2 지원 여부파일 다운로드1
12499정성태1/20/202110282.NET Framework: 1013. .NET Core Kestrel 호스팅 - 포트 변경, non-localhost 접속 지원 및 https 등의 설정 변경 [1]파일 다운로드1
12498정성태1/20/20219229.NET Framework: 1012. .NET Core Kestrel 호스팅 - 비주얼 스튜디오의 Kestrel/IIS Express 프로파일 설정
12497정성태1/20/202110143.NET Framework: 1011. C# - OWIN Web API 예제 프로젝트 [1]파일 다운로드2
12496정성태1/19/20219013.NET Framework: 1010. .NET Core 콘솔 프로젝트에서 Kestrel 호스팅 방법 [1]
12495정성태1/19/202111107웹: 40. IIS의 HTTP/2 지원 여부 - h2, h2c [1]
12494정성태1/19/202110318개발 환경 구성: 522. WSL2 인스턴스와 호스트 측의 Hyper-V에 운영 중인 VM과 네트워크 연결을 하는 방법 [2]
12493정성태1/18/20218680.NET Framework: 1009. .NET 5에서의 네트워크 라이브러리 개선 (1) - HTTP 관련 [1]파일 다운로드1
12492정성태1/17/20218068오류 유형: 695. ASP.NET 0x80131620 Failed to bind to address
12491정성태1/16/20219646.NET Framework: 1008. 배열을 반환하는 C# COM 개체의 메서드를 C++에서 사용 시 메모리 누수 현상 [1]파일 다운로드1
12490정성태1/15/20219238.NET Framework: 1007. C# - foreach에서 열거 변수의 타입을 var로 쓰면 object로 추론하는 문제 [1]파일 다운로드1
12489정성태1/13/202110186.NET Framework: 1006. C# - DB에 저장한 텍스트의 (이모티콘을 비롯해) 유니코드 문자가 '?'로 보인다면? [1]
12488정성태1/13/202110438.NET Framework: 1005. C# - string 타입은 shallow copy일까요? deep copy일까요? [2]파일 다운로드1
12487정성태1/13/20218951.NET Framework: 1004. C# - GC Heap에 위치한 참조 개체의 주소를 알아내는 방법파일 다운로드1
12486정성태1/12/20219896.NET Framework: 1003. x64 환경에서 참조형의 기본 메모리 소비는 얼마나 될까요? [1]
12485정성태1/11/202110630Graphics: 38. C# - OpenCvSharp.VideoWriter에 BMP 파일을 1초씩 출력하는 예제파일 다운로드1
12484정성태1/9/202111262.NET Framework: 1002. C# - ReadOnlySequence<T> 소개파일 다운로드1
12483정성태1/8/20218432개발 환경 구성: 521. dotPeek - 훌륭한 역어셈블 소스 코드 생성 도구
12482정성태1/8/20219855.NET Framework: 1001. C# - 제네릭 타입/메서드에서 사용 시 경우에 따라 CS8377 컴파일 에러
12481정성태1/7/20219590.NET Framework: 1000. C# - CS8344 컴파일 에러: ref struct 타입의 사용 제한 메서드파일 다운로드1
12480정성태1/6/202112188.NET Framework: 999. C# - ArrayPool<T>와 MemoryPool<T> 소개파일 다운로드1
12479정성태1/6/20219560.NET Framework: 998. C# - OWIN 예제 프로젝트 만들기
12478정성태1/5/202111169.NET Framework: 997. C# - ArrayPool<T> 소개파일 다운로드1
12477정성태1/5/202113566기타: 79. github 코드 검색 방법 [1]
12476정성태1/5/202110233.NET Framework: 996. C# - 닷넷 코어에서 다른 스레드의 callstack을 구하는 방법파일 다운로드1
... 31  32  33  34  35  36  37  38  39  40  41  42  43  44  [45]  ...