1,报错提示:
编辑器或项目正在尝试签出在内存中修改的文件,这将导致保存该文件。
在生成过程中保存文件是危险的,这可能会在将来导致不正确的生成输出。
是否仍然继续签出?
2,原因:licenses.licx属性设为了只读.
3,解决:
a,搜索''licenses.licx',去掉只读属性;
b,LicensesClear.exe放到项目根目录下,双击执行.
递归取消licenses.licx只读属性,源码
static class Program
{
//添加外部工具时参数可选为解决方案目录
static void Main(string[] args)
{
if (args == null || args.Length <= 0)
{
//LicensesClear(new DirectoryInfo(FilePathHelper.GetDirectoryName(FilePathHelper.GetAbsolutePath(string.Empty))));
}
else
{
foreach (string path in args)
if (path != null && Directory.Exists(path))
LicensesClear(new DirectoryInfo(path));
}
}
//递归取消licenses.licx文件的只读属性
private static void LicensesClear(DirectoryInfo directoryInfo)
{
DirectoryInfo subDirInfo;
FileInfo subFileInfo;
foreach (FileSystemInfo sysInfo in directoryInfo.GetFileSystemInfos())
{
if ((subDirInfo = sysInfo as DirectoryInfo) != null)//存在子级文件
{
LicensesClear(subDirInfo);
}//设置文件只读
else if ((subFileInfo = sysInfo as FileInfo) != null && subFileInfo.Name.ToLower().Equals("licenses.licx"))
{
subFileInfo.IsReadOnly = false;//去掉只读
if (subFileInfo.Length > 0)
using (FileStream fs = subFileInfo.OpenWrite())
{
fs.Seek(0, SeekOrigin.Begin);
fs.SetLength(0);
}
Console.WriteLine(string.Format("已清理:{0}", subFileInfo.FullName));
}
}
}
}