Precompiling error files over 260 characters

This happens usually when you are precompiling templates of a big project with many subfolders, or with long name paths.

To fix it, we need to set an intermediate folder to precompile our files before copying them to our publish folder following these steps:

  1. Go to your project folder, navigate to Properties\PublishProfiles folder.
  2. Open your profile file “profile_name.pubxml”, ignore the profile_name.pubxml.user.
  3. Add this param to your profile config with your chosen folder <AspnetCompileMergeIntermediateOutputPath>[PATH_TO_YOUR_FOLDER]</AspnetCompileMergeIntermediateOutputPath> under <PropertyGroup> tag. In my case I chose a folder with a really short name: “D:\.net\”.
  4. Save your file and you should be able to publish your project.


Leave a Reply