SharedIT | 묻고 답하기(AMP)

Visual Studio 2019 Setup Project 내 배포파일 경로변경관련문의

비주얼 스튜디오 깔고.. 배포할 파일을 만들고 싶어서.. 열심히 구글링을 하고 있으나..




몇일째 해결이 되지 않아.. 답답한 마음에 글을 올립니다.




제가 구현하고자 하는 내용은 아래와 같습니다.




1. 위치 : C:\Users\[사용자계정명]\AppData\LocalLow\NPKI\




2. 내용 : 빌드된 EXE실행 또는 배포시 등록된 파일 5개 카피하여 위에 명시된 위치에 파일 복사되는 기능




아래와 같이 DefaultLocation 부분을 수정하고자 속성부분을 수정하고 있는데..




아무래도 [LocalAppDataFolder] 는 기본적으로 C:\Users\[사용자계정명]\AppData\Local\ 가 포함되어




Local 까지 빠지게 되더군요. MS에 INSTALLATION-CONTEXT를 참조해도 이 전단계인 appdata 까지만 위치해서 NPKI로 보면되는데




혹시 appdata\npki까지로 나타내게 할 수 있는 방법이 있을지 궁금하여 질문글을 남깁니다.




appdata까지만 접근되어도 괜찮습니다. ㅜㅜ



참고 : https://docs.microsoft.com/en-us/windows/win32/msi/installation-context



Tags : 태그가 없습니다.

1개의 답변이 있습니다.

wansoo
  0 추천 | 약 2년 전

( 또 내용을 길게 적었다가 작성 누르자 블락으로... 적은 내용이 다 날라 가 버려 다시 적네요.. OTL )


Setup Project를 사용하지 않다 보니...

원하는 내용을 알려 드리기는 어렵지만...


원하는 내용이 소프트웨어 패키지를 설치하는 과정 중에 몇개 파일들을 특정 위치에 복사하고 싶다는 내용인것 같은데요.

다양한 방법들이 있을 수 있겠지만...


패키지 설치중에 Custom Action으로 Batch file 실행시켜 주는 방식으로 처리해도 되지 않을까 싶어 보이네요.


Batch file에다 원하는 파일들을 특정 위치에 복사하도록 명령을 만들어 두면 될 것 같고요.

예를 들어 아래와 같이 배치 파일을 만들면 되지 않을까 싶고...

============

@echo off

copy "복사할원본파일1" "C:\Users\[사용자계정명]\AppData\LocalLow\NPKI\"

copy "복사할원본파일2" "C:\Users\[사용자계정명]\AppData\LocalLow\NPKI\"

============


Custom Action으로 배치 File을 실행시키는 방법은 아래 링크를 참조하면 될걸로 보이고요.

https://docs.microsoft.com/en-us/answers/questions/615466/how-to-run-a-34bat34-file-during-install-custom-ac.html



1. Create a setup project and configure as you normally would, including the subdirectory in which you'll place your batch file (you can just place it in the Application Folder directly if you don't want it in a subdirectory).


2. In the "File System" view (right-click on the project in Solution Explorer->View->File System), add the batch file you want to execute and cmd. exe (C:\Windows\System32\cmd. exe)


3. Open the "Custom Actions" view (right-click on the project in Solution Explorer->View->Custom Actions)


4. Right-click on "Commit" and choose "Add Custom Action"


5. Navigate to and select cm d.exe.


6. Open the properties panel for the newly created custom action.


7. Delete /Commit from the Arguments property.


8. Enter: /c "[TARGETDIR]subdirectoryname\batchfile.bat" in the Arguments property, where subdirectoryname should be replaced by the name of your subdirectory (if you put the batch file in a subdirectory like I did... if you didn' t, the value should be /c "[TARGETDIR]batchfile.bat") and batchfile.bat should be the filename of your batch file.

wansoo | 약 2년 전

작성 글에 

cmd .exe

를 빈칸없이 붙여적으면 block으로 글이 저장되지 못하고 모두 없어지는 오류가 발생하네요. ㅠ

무지 | 약 2년 전

오 답변감사드립니다^^! 참고해서 확인해보겠습니다.

(일이 너무 바빠 이제 들어와서 확인했네요 ㅜㅜ)