Visual Studio 建置時複製目錄下檔案到根目錄

  • 1540
  • 0

Visual Studio 建置時複製目錄下檔案到根目錄

Visual Studio 專案下的目錄底下的檔案要在編譯時輸出到根目錄下,

首先先卸載專案,再編輯專案,

找到檔案的區塊把Content改成ContentWithTargetPath並加上TargetPath

修改前

    <Content Include="Common\WinRing\WinRing0.dll">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>

修改後

    <ContentWithTargetPath Include="Common\WinRing\WinRing0.dll">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <TargetPath>WinRing0.dll</TargetPath>
    </ContentWithTargetPath>