我有一个VSIX项目,它将在ASPNET5项目的Project.json文件中进行一些更改.我正在使用以下内容编辑.json文件.
ProjectJson jsonObj = JsonConvert.DeserializeObject<ProjectJson>(jsonContents); jsonObj = JsonConvert.DeserializeObject<ProjectJson>(jsonContents); var resultJson = JsonConvert.SerializeObject(jsonObj,Formatting.Indented); JsonSerializer serializer = new JsonSerializer(); using (StreamWriter sw = new StreamWriter(projectObjects.ProjectJsonPath)) { var writer = new JsonTextWriter(sw); serializer.Serialize(writer,resultJson); } // File.WriteAllText(projectObjects.ProjectJsonPath,resultJson);
通过使用stream writer和writealltext我在ASPNET 5项目中获取以下消息
@H_502_13@The file has unsaved changes inside this editor and has been changed
externally. do you want to reload it?