Could not write lines to file/Unable to delete file, Access to the path is denied.

When you get code from TFS or VSS, and you build the project, you may encounter the following error or warning message:

Error : Could not write lines to file "obj\Activities.csproj.FileList.txt". Access to the path '\obj\Activities.csproj.FileList.txt' is denied. Activities

Warning :Unable to delete file "\bin\Debug\MMOneTest.dll.config". Access to the path is denied. 

Issue: As you can see, MSBuild is trying to write to the *.vbproj.FileList.txt file in the \obj folder, but access is denied. If you look at this file on disk, you will notice that it is marked as read-only. No big deal, just turn off the read-only flag. You do this and rebuild, but the build passes. Very good! You go home with a nice case of the "warm fuzzies" and sleep like a baby. In the morning you come in to the office to find that the nightly build broke with the same exception. You look at the *.vbproj.FileList.txt file and it is read-only on the build machine. You scratch your head and let out a expletives and then delete the entire \obj folder. Then the nightly build is run again and if fails again damn it! Oh look, the *.vbproj.FileList.txt file is back to read-only. Sounding familiar yet?

Problem: The build fails because the *.vbproj.FileList.txt file is read-only so MSBuild can't write to it.

Reason: The file is read-only because you checked the \obj folder into source control. When ever you do a Get source code control, the files are placed on the drive as read-only. The nightly build is configured to delete the prior run's source code (or should be) and Get from source control prior to building. Therefore every nightly build fails in the same way.

Solution: Delete the \obj or \bin folder from source control and check-in the change. That's it.

转载于:https://www.cnblogs.com/johnnyqian/archive/2010/08/23/1806354.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值