microsoft / DockerTools

Tools For Docker, including Visual Studio Provisioning and Publishing
Other
175 stars 26 forks source link

Project volume does not include linked files #378

Closed andrew-hampton closed 1 year ago

andrew-hampton commented 1 year ago

When debugging within Visual Studio using Docker it creates a volume with a bind point for c:\app for the project directory. However, this misses any project files that aren't in the project directory, but are linked.

Example:

  <ItemGroup>
    <Content Include="..\Startup.ps1">
      <Link>Startup.ps1</Link>
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
  </ItemGroup>

Appreciate any suggestions on how to handle this scenarios

NCarlsonMSFT commented 1 year ago

@andrew-hampton You shouldn't need to reference it from the source folder and should instead be able to access it from your output directory. If you're using a command line app the output directory will be your working directory. Otherwise, you can Use Assembly.GetExecutingAssembly().Location to get the path for your assembly and the script should be in the same folder (unless you've customized your build).

andrew-hampton commented 1 year ago

Thanks @NCarlsonMSFT! I was able to access it from within the output directory. We use a startup script to arrange some things before starting our executable and the shift in how things are arranged within Visual Studio debugging compared to our normal layout caused some confusion.