从 Visual Studio 中一个全新的控制台应用程序模板,我编辑了.csproj
另一个项目,如下所示:
...
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="BeforeBuild">
<MSBuild Projects=".\other.mproj"/>
</Target>
...
在哪里other.mproj
:
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<Target Name="Build">
<Message Text="kikou" />
</Target>
</Project>
过了一会儿,我发现除非在 Visual Studio 中卸载/重新加载项目,否则不会考虑修改内容other.mproj
(例如,通过引入错误或将文本更改为其他内容)。kikou
从命令行构建并'msbuild myproj.csproj'
立即检测'other.mproj'
. 所以看起来 Visual Studio 正在使用缓存版本的other.mproj
文件。
为什么 Visual Studio 缓存这个其他脚本(甚至不包含在项目中),我该如何解决这个问题?
更新:我也试过这个UseHostCompilerIfAvailable,它不起作用。
NB1:我没有在中添加other.mproj
作为项目引用,.csproj
因为它根本不是 .NET 项目(它只是.csproj
在构建之前从其他输入创建资源文件)
NB2:我正在使用 VS2010 (10.0.10219.1SP1Rel + MSBuild 4.0.30319.1)