Microsoft MVP성태의 닷넷 이야기
글쓴 사람
정성태 (techsharer at outlook.com)
홈페이지
첨부 파일
 

Visual Studio - Build Events에 robocopy를 사용할때 "Invalid Parameter #1" 오류가 발행하는 경우

이상하군요, 단순하게 다음과 같이 빌드 이벤트를 만들었는데,

$(ProjectDir)postBuildScript.bat "$(TargetDir)" $(TargetName)

REM postBuildScript.bat
robocopy %1 d:\temp %2.*

exit 0

빌드 시 오류가 발생합니다.

Error Invalid Parameter #1 : "E:\ConsoleApp1\bin\Debug" d:\temp ConsoleApp1.*"

원인은 지난 글에 쓴 것과 같은 이유인데,

robocopy - ERROR : No Destination Directory Specified.
; https://www.sysnet.pe.kr/2/0/12441

TargetDir이 넘겨주는 값이 "E:\ConsoleApp1\bin\Debug\"와 같이 마지막에 '\' 글자를 포함하고 있기 때문입니다. 하지만 오류 메시지의 출력 결과가 이번에는 다릅니다.

Rebuild started...
1>------ Rebuild All started: Project: ConsoleApp1, Configuration: Debug Any CPU ------
1>  ConsoleApp1 -> E:\ConsoleApp1\bin\Debug\ConsoleApp1.dll
1>  AnyCPU "E:\ConsoleApp1\bin\Debug\" ConsoleApp1
1>  
1>  -------------------------------------------------------------------------------
1>     ROBOCOPY     ::     Robust File Copy for Windows                              
1>  -------------------------------------------------------------------------------
1>  
1>    Started : 03 12월 2020 오전 10:24:53
1>     Source - 
1>       Dest - 
1>  
1>      Files : 
1>    Options : /DCOPY:DA /COPY:DAT /R:1000000 /W:30 
1>  
1>  ------------------------------------------------------------------------------
1>  
1>EXEC : error : Invalid Parameter #1 : "E:\ConsoleApp1\bin\Debug" d:\temp ConsoleApp1.*""
1>  
1>         Simple Usage :: ROBOCOPY source destination /MIR
1>  
1>               source :: Source Directory (drive:\path or \\server\share\path).
1>          destination :: Destination Dir  (drive:\path or \\server\share\path).
1>                 /MIR :: Mirror a complete directory tree.
1>  
1>      For more usage information run ROBOCOPY /?
1>  
1>                                                            
1>  ****  /MIR can DELETE files as well as copy them !
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(5461,5): error MSB3073: The command "E:\ConsoleApp1\postBuildScript.bat  AnyCPU "E:\ConsoleApp1\bin\Debug\" ConsoleApp1
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(5461,5): error MSB3073: " exited with code -1.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

어쨌든, 이 원인을 고치려면 지난 글에 소개한 3가지 방법 중 하나를 써야 하는데,

$(ProjectDir)postBuildScript.bat "$(TargetDir)" $(TargetName)

TargetDir 경로에 공백이 포함되어 있다면 다음과 같이 마지막에 '\' 문자를 하나 더 추가한 후 겹따옴표로 감쌀 수 있습니다.

$(ProjectDir)postBuildScript.bat $(PlatformName) "$(TargetDir)\" $(TargetName)




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







[최초 등록일: ]
[최종 수정일: 12/4/2020]

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

비밀번호

댓글 작성자
 




... 16  17  18  19  20  21  22  23  24  25  26  27  28  [29]  30  ...
NoWriterDateCnt.TitleFile(s)
12906정성태1/9/20227067.NET Framework: 1131. C# - 네임스페이스까지 동일한 타입을 2개의 DLL에서 제공하는 경우 충돌을 우회하는 방법 [1]파일 다운로드1
12905정성태1/8/20226731오류 유형: 780. Could not load file or assembly 'Microsoft.VisualStudio.TextTemplating.VSHost.15.0, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
12904정성태1/8/20228741개발 환경 구성: 623. Visual Studio 2022 빌드 환경을 위한 github Actions 설정 [1]
12903정성태1/7/20227314.NET Framework: 1130. C# - ELEMENT_TYPE_INTERNAL 유형의 사용 예
12902정성태1/7/20227382오류 유형: 779. SQL 서버 로그인 에러 - provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe.
12901정성태1/5/20227424오류 유형: 778. C# - .NET 5+에서 warning CA1416: This call site is reachable on all platforms. '...' is only supported on: 'windows' 경고 발생
12900정성태1/5/20229106개발 환경 구성: 622. vcpkg로 ffmpeg를 빌드하는 경우 생성될 구성 요소 제어하는 방법
12899정성태1/3/20228605개발 환경 구성: 621. windbg에서 python 스크립트 실행하는 방법 - pykd (2)
12898정성태1/2/20229160.NET Framework: 1129. C# - ffmpeg(FFmpeg.AutoGen)를 이용한 비디오 인코딩 예제(encode_video.c) [1]파일 다운로드1
12897정성태1/2/20228025.NET Framework: 1128. C# - 화면 캡처한 이미지를 ffmpeg(FFmpeg.AutoGen)로 동영상 처리 [4]파일 다운로드1
12896정성태1/1/202210895.NET Framework: 1127. C# - FFmpeg.AutoGen 라이브러리를 이용한 기본 프로젝트 구성파일 다운로드1
12895정성태12/31/20219358.NET Framework: 1126. C# - snagit처럼 화면 캡처를 연속으로 수행해 동영상 제작 [1]파일 다운로드1
12894정성태12/30/20217305.NET Framework: 1125. C# - DefaultObjectPool<T>의 IDisposable 개체에 대한 풀링 문제 [3]파일 다운로드1
12893정성태12/27/20218897.NET Framework: 1124. C# - .NET Platform Extension의 ObjectPool<T> 사용법 소개파일 다운로드1
12892정성태12/26/20216896기타: 83. unsigned 형의 이전 값이 최댓값을 넘어 0을 지난 경우, 값의 차이를 계산하는 방법
12891정성태12/23/20216834스크립트: 38. 파이썬 - uwsgi의 --master 옵션
12890정성태12/23/20216949VC++: 152. Golang - (문자가 아닌) 바이트 위치를 반환하는 strings.IndexRune 함수
12889정성태12/22/20219365.NET Framework: 1123. C# - (SharpDX + DXGI) 화면 캡처한 이미지를 빠르게 JPG로 변환하는 방법파일 다운로드1
12888정성태12/21/20217518.NET Framework: 1122. C# - ImageCodecInfo 사용 시 System.Drawing.Image와 System.Drawing.Bitmap에 따른 Save 성능 차이파일 다운로드1
12887정성태12/21/20219598오류 유형: 777. OpenCVSharp4를 사용한 프로그램 실행 시 "The type initializer for 'OpenCvSharp.Internal.NativeMethods' threw an exception." 예외 발생
12886정성태12/20/20217502스크립트: 37. 파이썬 - uwsgi의 --enable-threads 옵션 [2]
12885정성태12/20/20217771오류 유형: 776. uwsgi-plugin-python3 환경에서 MySQLdb 사용 환경
12884정성태12/20/20216823개발 환경 구성: 620. Windows 10+에서 WMI root/Microsoft/Windows/WindowsUpdate 네임스페이스 제거
12883정성태12/19/20217676오류 유형: 775. uwsgi-plugin-python3 환경에서 "ModuleNotFoundError: No module named 'django'" 오류 발생
12882정성태12/18/20216770개발 환경 구성: 619. Windows Server에서 WSL을 위한 리눅스 배포본을 설치하는 방법
12881정성태12/17/20217273개발 환경 구성: 618. WSL Ubuntu 20.04에서 파이썬을 위한 uwsgi 설치 방법 (2)
... 16  17  18  19  20  21  22  23  24  25  26  27  28  [29]  30  ...