Visual Studio 캐시 삭제 - Visual Studio kaesi sagje

visual studio를 처음에 잘못 설치하여 재설치 하려니 오류가 뜨면서 재설치가 안된다 ㅠㅠㅠ

이럴때 완전히 삭제하고 다시 설치해야하는데

제어판에 들어가서 프로그램 제거를 해도 캐시가 남아서 완벽히 삭제가 되지 않는 상황이 생겼다.

이럴 경우 visual studio의 완벽 삭제 방법을 소개한다.

아래 주소로 들어가서 TotalUninstaller.zip 파일을 다운로드 받은후 압축을 푼다.

https://github.com/Microsoft/VisualStudioUninstaller/releases

Visual Studio 캐시 삭제 - Visual Studio kaesi sagje

2. Setup.ForcedUninstall.exe 실행

Setup.ForcedUninstall.exe을 관리자 권한으로 실행한다.

관리자 권한으로 실행하지 않으면 삭제가 되지 않으니 반드시 관리자 권한으로 실행시키자 !!

visual studio 2013, visual studio 2015 버전만 삭제가 가능하며, 프로그램을 실행하려면 Y 를 입력한뒤 엔터를 누르면 된다.

Visual Studio 캐시 삭제 - Visual Studio kaesi sagje

처음엔 cmd 창에서 아무런 변화가 없지만 천천히 기다리면 프로그램 삭제가 진행된다.

필자는 완벽히 삭제가 되길 바라며 2번 삭제 시켰다.

아래는 다시 재설치하는 모습 ㅎㅎ

설치 잘 된다 ㅎㅎ

Visual Studio 캐시 삭제 - Visual Studio kaesi sagje

빌드 캐시는 프로젝트를 빌드할 때 Gradle용 Android 플러그인이 생성하는 특정 출력(예: 패키지 해제된 AAR 및 사전 덱싱 원격 종속 항목)을 저장합니다. 클린 빌드는 캐시를 사용하는 동안 훨씬 더 빠릅니다. 그 이유는 빌드 시스템이 후속 빌드 중에 캐시된 파일을 다시 생성하는 것이 아니라 재사용하면 되기 때문입니다. 또한 빌드 캐시는 지속적 통합 서버에서 작동하며, 단일 로컬 시스템에서 여러 빌드 프로세스를 실행할 때도 작동합니다.

Android 플러그인 2.3.0 이상을 사용하는 프로젝트는 기본적으로 빌드 캐시를 사용 설정합니다. 명시적으로 빌드 캐시를 사용 중지하는 경우는 예외입니다. 그러나 다음 빌드 속성 중 하나를 아래와 다르게 설정한 경우, 플러그인은 사전 덱싱 원격 종속 항목의 캐싱을 사용 중지합니다. 각 속성의 기본 설정이므로 설정을 선언하지 않은 경우에는 사전 덱싱 원격 종속 항목의 캐싱이 사용 설정 상태로 유지됩니다.

android {
  defaultConfig {
    // If you do enable multidex, you must also set
    // minSdkVersion to 21 or higher.
    multiDexEnabled false
  }
  buildTypes {
    <build-type> {
      minifyEnabled false
    }
  }
  dexOptions {
    preDexLibraries true
  }
  ...
}
...

참고: 프로젝트에서 Android 플러그인 버전 2.2.2 또는 2.2.3을 사용하는 경우에는 시험용 버전의 빌드 캐시 기능을 사용하게 됩니다. 최신 버전의 Android 플러그인을 사용하려면 프로젝트를 업데이트해야 합니다.

빌드 속도를 향상하는 다른 방법에 관해 알아보려면 빌드 속도 최적화를 참조하세요.

빌드 캐시의 위치 변경

기본적으로 Android 플러그인은 캐시를 <user-home>/.android/build-cache/에 저장합니다. 높은 우선 순위부터 나열된 다음 경로 변수 중 하나를 구성하면 Android 스튜디오에서는 <path-variable>/.android/build-cache/를 대신 사용합니다.

  • ANDROID_SDK_HOME
  • user.home
  • HOME

Android 플러그인은 하나의 기본 위치를 빌드 캐시에 사용하므로 Android 플러그인 2.3.0 이상을 사용하고 빌드 캐시를 사용 중지하지 않는 모든 프로젝트 간에 캐시된 파일을 공유할 수 있습니다. 예를 들어, 한 프로젝트에서 사전 덱싱 종속 항목을 빌드하고 캐시한 후 이 종속 항목을 사용하는 다른 프로젝트에서 공유 빌드 캐시로부터 종속 항목을 복사하여 다시 사전 덱싱하는 과정을 건너뛸 수 있습니다.

프로젝트가 자체 캐시를 생성하여 다른 프로젝트와 공유하지 않도록 하려면 다음과 같이 프로젝트의

// You can specify either an absolute path or a path relative
// to the gradle.properties file.
android.buildCacheDir=<path-to-directory>
0 파일에 고유 캐시 위치를 지정할 수 있습니다.

// You can specify either an absolute path or a path relative
// to the gradle.properties file.
android.buildCacheDir=<path-to-directory>

파일 편집을 완료하면 Sync Project

Visual Studio 캐시 삭제 - Visual Studio kaesi sagje
를 클릭하여 새로운 빌드 캐시 디렉터리를 만듭니다.

참고:

// You can specify either an absolute path or a path relative
// to the gradle.properties file.
android.buildCacheDir=<path-to-directory>
1 또는
// You can specify either an absolute path or a path relative
// to the gradle.properties file.
android.buildCacheDir=<path-to-directory>
2 디렉터리 내에 있는 빌드 캐시에는 디렉터리를 지정하지 마세요. Gradle이
// You can specify either an absolute path or a path relative
// to the gradle.properties file.
android.buildCacheDir=<path-to-directory>
3 작업을 실행할 때마다 이러한 디렉터리를 삭제하기 때문입니다.

다른 특정 프로젝트에서만 캐시를 공유하려면 이러한 프로젝트의

// You can specify either an absolute path or a path relative
// to the gradle.properties file.
android.buildCacheDir=<path-to-directory>
0 파일에 동일한 빌드 캐시 디렉터리를 지정하세요.

빌드 캐시 삭제

프로젝트의

// You can specify either an absolute path or a path relative
// to the gradle.properties file.
android.buildCacheDir=<path-to-directory>
5 디렉터리를 삭제하는 Android 플러그인의
// You can specify either an absolute path or a path relative
// to the gradle.properties file.
android.buildCacheDir=<path-to-directory>
3 작업과 마찬가지로
// You can specify either an absolute path or a path relative
// to the gradle.properties file.
android.buildCacheDir=<path-to-directory>
7 작업을 실행하여 프로젝트의 빌드 캐시를 삭제할 수 있습니다. 프로젝트가 빌드 캐시에 기본이 아닌 디렉터리를 지정하면 프로젝트에서 이 작업을 실행할 때 캐시만 삭제되며 기본 위치의 공유된 캐시는 삭제되지 않습니다. 작업을 실행하려면 메뉴 바에서 View > Tool Windows > Terminal을 선택하고 다음 명령어 중 하나를 사용합니다.

  • Windows:
    gradlew cleanBuildCache
  • Mac 또는 Linux:
    ./gradlew cleanBuildCache

참고:

// You can specify either an absolute path or a path relative
// to the gradle.properties file.
android.buildCacheDir=<path-to-directory>
7 작업은 빌드 캐시를 사용 중지하면 사용할 수 없습니다.

빌드 캐시 사용 중지

빌드 캐시는 클린 빌드의 속도를 높여주므로 이 기능을 사용 중지하는 것은 권장하지 않습니다. 그래도 프로젝트의 빌드 캐시를 사용 중지하려면 다음을

// You can specify either an absolute path or a path relative
// to the gradle.properties file.
android.buildCacheDir=<path-to-directory>
0 파일에 추가합니다.

// To re-enable the build cache, either delete the following
// line or set the property to 'true'.
android.enableBuildCache=false

파일 편집을 완료하면 Sync Project

Visual Studio 캐시 삭제 - Visual Studio kaesi sagje
를 클릭하여 변경사항을 적용합니다.

참고: 빌드 캐시를 사용 중지하면 Android 플러그인은

gradlew cleanBuildCache
0 속성을 무시하고
// You can specify either an absolute path or a path relative
// to the gradle.properties file.
android.buildCacheDir=<path-to-directory>
7 작업은 더 이상 사용할 수 없습니다. 빌드 캐시를 사용 중지하더라도 캐시 디렉터리가 자동으로 지워지지는 않습니다. 따라서 빌드 캐시를 다시 사용 설정할 경우 캐시된 파일을 그대로 유지할 수 있습니다.