When you perform Layer Validation using the tools available from the Architecture menu in Enterprise versions of Visual Studio 2012 and 2013, especially when Layer Validation is part of a Build process, you may find excessive growth of the user’s temporary folder due to caching of binary assemblies. This issue does not affect final release versions Visual Studio 2015.
The LmrProvider class is used to access the content of managed assemblies when Layer Validation is performed. Shadow copies of these assemblies are placed in the user’s temporary folder, and may not be removed automatically after the process is complete. This results in rapid growth of the size of the temporary folder, and may eventually lead to problems through long start-up times and shortage of disk space.
The temporary folder will have a path and name of the form:
Which is usually:
The simplest workaround is to include a post-build script in your Build process that empties or completely deletes the LmrProviderTempAssemblyFolder folder. By including the script in the post-build event of the .modelproj file, the workaround will be effective from the IDE and from the command line (non-team) build as well.
- Unload the modeling project that contains the layer diagram by right clicking on it in Solution Explorer and choosing Unload Project.
- Open the project file into the editor by right clicking on it in Solution Explorer and choosing Edit projectname.modelproj.
Add the following property group inside and at the end of the <Project> element (immediately before the closing </Project> tag:
<PostBuildEvent>rd /s /q $(temp)LmrProviderTempAssemblyFolder 2>nul</PostBuildEvent>
- Save the project file.
- Right click on the modeling project in Solution Explorer and choose Reload Project.
For more information about creating post-build scripts, see Run a script in your build process on MSDN.
For more information about Layer Validation, see Validate Code with Layer Diagrams on MSDN.