0

I wanted to publish my project with "PreCompile During Publish" option checked but I get this error:

Copying file VERYLONGDIRECTORY\P.aspx to obj\Release\AspnetCompileMerge\Source\VERYLONGDIRECTORY\P.aspx failed. Could not find a part of the path 'obj\Release\AspnetCompileMerge\Source\VERYLONGDIRECTORY\P.aspx'.

I deleted the file from the project and the publish succeeded. Then, re-added the ASPX file to the project and the error is popping up again. I excluded it from the project and it works. I need the ASPX file to be in my project, this is a bit weird...

What should I do?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
AQAADN
  • 3
  • 2

2 Answers2

0

Please tell me that the above exception was copied and pasted for this question? Because, I could find a Typo in the exception which is given below: Copying file VERYLONGDIRECTORY\P.aspx to obj\Release\AspnetCompileMerge\Source\VERYLONGDIRECTORY\P.aspx.aspx failed ,this line ends with dual P.aspx.aspx extension. This typo would be a reason if not then do check some links below.

I have provided some links related to your exception, If you have not already visited, then do check their are multiple solutions and you could find one.

IntelliSense keeps giving [Failure] Could not find a part of the path C:\TEMP

ASP.NET publish trying to copy a non-existant file

  • Hello there. Yes, the filename was so long and while I was replacing the name, I added the format again so yeah, that's a typo. – AQAADN Mar 28 '21 at 05:13
  • I had already tried those. @Jefferson Raposo's answer helped. – AQAADN Mar 28 '21 at 05:34
0

Try put the following in your publish profile (.pubxml)

<aspnetcompilemergeintermediateoutputpath>c:\temp</aspnetcompilemergeintermediateoutputpath>

This will change the temporary path where the project is built. Windows has a max length of 260 characters for file path.

  • Hi there. Thanks for the answer. It worked. So, why is there a need of this tag in the profile? – AQAADN Mar 28 '21 at 05:24
  • This will change the temporary path where the project is built – Jefferson Raposo Mar 28 '21 at 12:43
  • Hi @Jefferson Raposo. Sorry for the late response. Yeah, I got that. I meant what is actually the problem? Should VS developers fix it or something? I was just curious to know why this temporary path is needed. – AQAADN Mar 31 '21 at 01:16