RT0405
RT0405
CC#
Created by RT0405 on 10/22/2023 in #help
✅ is there a way to delete or overwrite a dll during the postbuild event?
I'm trying to do some il weaving as a post build event, and I'd like to either overwrite the old dll, or make a new file and delete the old one, however I always get an IOException (another process is using this file) which I presume comes from msbuild still holding onto the file during the postbuild event. tldr: is there a workaround to allow automatic post build weaving in visual studio that I don't know of or am I missing something edit: here's my current csproj file, without the library references (if they matter I can add them)
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<AssemblyName>$(MSBuildProjectName)</AssemblyName>
<TargetName>$(MSBuildProjectName)unweaved</TargetName>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebugType>embedded</DebugType>
</PropertyGroup>

<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="start ..\Velrdid.OpenXR.PostCompilerFixup\bin\Release\net6.0\Veldrid.OpenXR.PostCompilerFixup.exe" />
</Target>
</Project>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<AssemblyName>$(MSBuildProjectName)</AssemblyName>
<TargetName>$(MSBuildProjectName)unweaved</TargetName>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebugType>embedded</DebugType>
</PropertyGroup>

<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="start ..\Velrdid.OpenXR.PostCompilerFixup\bin\Release\net6.0\Veldrid.OpenXR.PostCompilerFixup.exe" />
</Target>
</Project>
3 replies