Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I don't know how you would disable the VS cache, however I may have a workaround that would allow you to edit the build target without having to reload the solution.</p> <p>You could use the MSBuild task in your proj file to call a wrapper target that copies your CopyDependencies.target file to CopyDependencies.[RandomNumber].target, then invokes your CopyDependencies target in the newly created file, and finally deletes it.</p> <p>This would force VS to reload the target on each invocation as the filename is different.</p> <p>Here's an example: </p> <p>myProject.proj</p> <p>Add this to the AfterBuild target:</p> <pre><code>&lt;MSBuild Projects="Wrapper.target" Targets="MyWrappedTarget" UnloadProjectsOnCompletion="true"/&gt; </code></pre> <p>Wrapper.target</p> <p>Here we have the target that will - at build time - copy the real target file and invoke the desired build target within it (I've used an inline c# task which is only available in MSBuild 4.0):</p> <pre><code> &lt;UsingTask TaskName="RandomNumber" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll"&gt; &lt;ParameterGroup&gt; &lt;Number ParameterType="System.Int32" Output="true"/&gt; &lt;/ParameterGroup&gt; &lt;Task&gt; &lt;Code Type="Fragment" Language="cs"&gt; &lt;!-- CDATA --&gt; Random rndGenerator = new Random(); Number = rndGenerator.Next(Int32.MaxValue); &lt;!-- CDATA --&gt; &lt;/Code&gt; &lt;/Task&gt; &lt;/UsingTask&gt; &lt;Target Name="MyWrappedTarget"&gt; &lt;Message Text="MyWrappedTarget target called"/&gt; &lt;RandomNumber&gt; &lt;Output TaskParameter="Number" PropertyName="FileNumber"/&gt; &lt;/RandomNumber&gt; &lt;PropertyGroup&gt; &lt;CopiedTarget&gt;inner.test.$(FileNumber).target&lt;/CopiedTarget&gt; &lt;/PropertyGroup&gt; &lt;Copy SourceFiles="inner.test.target" DestinationFiles="$(CopiedTarget)"/&gt; &lt;MSBuild Projects="$(CopiedTarget)" Targets="_innerTestTarget"/&gt; &lt;Delete Files="$(CopiedTarget)"/&gt; &lt;/Target&gt; </code></pre> <p>inner.test.target</p> <p>This contains the real build target you want to execute, in this example it's a simple file copy.</p> <pre><code> &lt;Target Name="_innerTestTarget"&gt; &lt;Message Text="This is a inner test text message"/&gt; &lt;Copy SourceFiles="x.txt" DestinationFiles="x1.txt"/&gt; &lt;/Target&gt; </code></pre> <p>This isn't production ready, but hopefully illustrates my point.</p> <p>With this (slightly convoluted) process in place, you can change the inner.test.target file without having to reload the solution in VS.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload