How to stop Visual Studio caching Imported MSBuild scripts?

大憨熊 提交于 2019-12-23 20:14:55

问题


I have a csproj file which references a shared MSBuild script with an <Import> directive. I have noticed that when I change the shared script, I need to close and reopen Visual Studio before it notices the change - a build within Visual Studio notices changes to the csproj file but not the shared file.

This doesn't happen when I build the project with MSBuild from the command line. Is Visual Studio caching the imported script? If so, why? And how can I turn off this behaviour which makes authoring build scripts hard / impossible using Visual Studio?

Thanks!


回答1:


Instead of closing and re-opening Visual Studio have you tried, unloading and reloading the project (.csproj) which imports the shared script? You can do this from the Solution Explorer in Visual Stduio by right clicking on the loaded project and selecting unload and then on the unloaded project and picking load.




回答2:


In my experience, Visual Studio 2015 behaves better than Visual Studio 2008. VS picks up changes from imported files in most cases, at least for C# projects. YMMV for other project types, though.

While the solution explorer doesn't reflect changes, the build uses the updated version of the import file.

So, the solution may be to use a more recent version of Visual Studio.



来源:https://stackoverflow.com/questions/2012742/how-to-stop-visual-studio-caching-imported-msbuild-scripts

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!