This is very different compared to How to tell visual studio to rebuild every time I make a change?
The issue is that I have modified a csproj that is not referenced a project (because it's run-time dependency).
So for example, in my csproj file I have:
<Import Project=".\UnreferencedProjects-Developer.targets" />
In my .targets
file, I have:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="BuildDependencyForDevelopers" AfterTargets="Build">
<Message Text="========================================" />
<Message Text="Developer Building Unreferenced Projects" />
<Message Text="========================================" />
<!--MSBuild Projects="$(ProjectToBuild)"-->
<MSBuild Projects="../OtherProject/OtherProject.csproj">
<Output ItemName="ProjectOutputs" TaskParameter="TargetOutputs"/>
</MSBuild>
<Message Text="@(ProjectOutputs)"/>
<Message Text="=======================================" />
<Message Text="Developer Copying Unreferenced Projects" />
<Message Text="=======================================" />
<Copy SourceFiles="$(ProjectDir)\..\OtherProject\bin\$(Configuration)\OtherProject.dll" DestinationFolder="$(OutDir)" ContinueOnError="true"/>
<Copy SourceFiles="$(ProjectDir)\..\OtherProject\bin\$(Configuration)\OtherProject.pdb" DestinationFolder="$(OutDir)" ContinueOnError="true"/>
<Message Text="=============================================" />
<Message Text="Developer Finished with Unreferenced Projects" />
<Message Text="=============================================" />
</Target>
</Project>
The issue is that the .targets.
file seems to only execute on a manual build/rebuild, and not on a Start Debugging.
All Configurations are set to Build. Options -> Project and Solutions -> Build and Run -> On Run, when projects are out of date: Always build.
I think the issue is that because the project is unreferenced, when I Start Debugging there are no out of date projects so it launches without a build/rebuild. How do I force it to literally always (re)build.