Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using Microsoft.DotNet.MSIdentity.AuthenticationParameters;
using Microsoft.DotNet.MSIdentity.Project;
using Microsoft.DotNet.MSIdentity.Properties;
Expand Down Expand Up @@ -47,7 +48,7 @@ internal static void WriteConfiguration(Summary summary, IEnumerable<Replacement
{
File.Copy(filePath, filePath + "%");
}
File.WriteAllText(filePath, fileContent);
File.WriteAllText(filePath, fileContent, new UTF8Encoding(false));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ private void AddFile(CodeFile file)
if (!string.IsNullOrEmpty(fileDir))
{
Directory.CreateDirectory(fileDir);
File.WriteAllText(filePath, codeFileString);
File.WriteAllText(filePath, codeFileString, new UTF8Encoding(false));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using Microsoft.DotNet.MSIdentity.AuthenticationParameters;
using Microsoft.DotNet.MSIdentity.Tool;
using Newtonsoft.Json.Linq;
Expand Down Expand Up @@ -70,7 +71,7 @@ public void ModifyAppSettings(ApplicationParameters applicationParameters, IEnum
// TODO: save comments somehow, only write to appsettings.json if changes are made
if (modifiedAppSettings != null)
{
System.IO.File.WriteAllText(_provisioningToolOptions.AppSettingsFilePath, modifiedAppSettings.ToString());
System.IO.File.WriteAllText(_provisioningToolOptions.AppSettingsFilePath, modifiedAppSettings.ToString(), new UTF8Encoding(false));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ private ProjectAuthenticationSettings ConvertAadApplicationToB2CApplication(Proj
+ updatedContent.Substring(indexCallbackPath);
}
}
System.IO.File.WriteAllText(filePath, updatedContent);
System.IO.File.WriteAllText(filePath, updatedContent, new UTF8Encoding(false));
}

if (projectSettings.ApplicationParameters.CallsMicrosoftGraph)
Expand Down
3 changes: 2 additions & 1 deletion src/Scaffolding/VS.Web.CG.Mvc/Dependency/ReadMeGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.DotNet.Scaffolding.Shared.Project;
using Microsoft.DotNet.Scaffolding.Shared.ProjectModel;
Expand Down Expand Up @@ -103,7 +104,7 @@ public void GenerateReadMeWithContent(string content)
Constants.ReadMeOutputFileName);
try
{
File.WriteAllText(outputPath, content);
File.WriteAllText(outputPath, content, new UTF8Encoding(false));
}
catch (Exception ex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public async Task WriteToClassFileAsync(string filePath)
{
var changedDocument = GetDocument();
var classFileTxt = await changedDocument.GetTextAsync();
File.WriteAllText(filePath, classFileTxt.ToString());
File.WriteAllText(filePath, classFileTxt.ToString(), new UTF8Encoding(false));
}

internal static BaseMethodDeclarationSyntax AddMethodParameters(BaseMethodDeclarationSyntax originalMethod, Method methodChanges, CodeChangeOptions options)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Threading.Tasks;

namespace Microsoft.DotNet.Scaffolding.Shared
Expand Down Expand Up @@ -72,7 +73,7 @@ public void RemoveDirectory(string path, bool recursive)

public void WriteAllText(string path, string contents)
{
File.WriteAllText(path, contents);
File.WriteAllText(path, contents, new UTF8Encoding(false));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Linq;
using System.Reflection;
using System.Runtime.Versioning;
using System.Text;

namespace Microsoft.Extensions.Internal
{
Expand Down Expand Up @@ -100,7 +101,7 @@ private static void EnsureBindingRedirects(string assemblyFullPath, string toolN
{
var text = File.ReadAllText(bindingRedirectFile);
var toolBindingRedirectFile = Path.Combine(Path.GetDirectoryName(assemblyFullPath), $"{toolName}.config");
File.WriteAllText(toolBindingRedirectFile, text);
File.WriteAllText(toolBindingRedirectFile, text, new UTF8Encoding(false));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ internal static void ApplyReplacementsOnFileOnDisk(string filePath, IEnumerable<

if (sourceChanged)
{
File.WriteAllText(filePath, sourceFileString);
File.WriteAllText(filePath, sourceFileString, new UTF8Encoding(false));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

using System.Diagnostics;
using System.Reflection;
using System.Text;

namespace Microsoft.DotNet.Scaffolding.Internal.Services;

Expand Down Expand Up @@ -41,7 +42,7 @@ public string ReadAllText(string filePath)
/// <inheritdoc />
public void WriteAllText(string filePath, string content)
{
File.WriteAllText(filePath, content);
File.WriteAllText(filePath, content, new UTF8Encoding(false));
}

/// <inheritdoc />
Expand All @@ -53,7 +54,7 @@ public string[] ReadAllLines(string filePath)
/// <inheritdoc />
public void WriteAllLines(string filePath, string[] content)
{
File.WriteAllLines(filePath, content);
File.WriteAllLines(filePath, content, new UTF8Encoding(false));
}

/// <inheritdoc />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Text;
using Microsoft.DotNet.Scaffolding.Core.Scaffolders;
using Microsoft.DotNet.Scaffolding.Core.Steps;
using Microsoft.Extensions.Logging;
Expand Down Expand Up @@ -92,7 +93,7 @@ public override Task<bool> ExecuteAsync(ScaffolderContext context, CancellationT
// If Overwrite is true, write file, or if it doesn't exist
if (Overwrite || !File.Exists(templatingProperty.OutputPath))
{
File.WriteAllText(templatingProperty.OutputPath, templatedString);
File.WriteAllText(templatingProperty.OutputPath, templatedString, new UTF8Encoding(false));
}
}
}
Expand Down