How to get Visual Studio to reread source files after BeforeBuild processing?

后端 未结 1 688
别那么骄傲
别那么骄傲 2021-01-14 11:49

I\'ve written a C# preprocessor that I\'ve incorporated into my .csproj projects by invoking it using the BeforeBuild MSBuild target. This works OK except that when the prep

相关标签:
1条回答
  • 2021-01-14 12:39

    This isn't an optimal solution, but it's the best I've come up with so far.

    As documented here http://social.msdn.microsoft.com/Forums/en-US/vsdebug/thread/6c042390-0782-4afe-94be-9746d75f5d34/ you can place

     <UseHostCompilerIfAvailable>false</UseHostCompilerIfAvailable>
    

    in the .csproj file, and that gets Visual Studio to use the "normal" C# compiler instead of the "internal" one that uses the cached files. This presumably reduces performance, but I haven't noticed it, or tried to measure it.

    And, as documented here http://startbigthinksmall.wordpress.com/2009/03/16/visual-studio-tipp-auto-refresh-file-changes/ you can get Visual Studio to stop nagging you about the updated files, and simply reload them.

    I would still prefer to find some way of telling Visual Studio to update its cached files and then invoke its internal compiler ...

    I'm marking this as "the answer", but I'd still like to hear better possibilities, and if that happens I'll unmark this one.

    0 讨论(0)
提交回复
热议问题