-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[main] Add nowarn for NU1903 (#44078)
Co-authored-by: Michael Simons <msimons@microsoft.com>
- Loading branch information
1 parent
a4e5d12
commit 1f220e4
Showing
2 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
...rceBuild/content/eng/tools/tasks/Microsoft.DotNet.UnifiedBuild.Tasks/ReplaceTextInFile.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using System.IO; | ||
using Microsoft.Build.Framework; | ||
using Microsoft.Build.Utilities; | ||
|
||
namespace Microsoft.DotNet.UnifiedBuild.Tasks | ||
{ | ||
public class ReplaceTextInFile : Task | ||
{ | ||
[Required] | ||
public string InputFile { get; set; } | ||
|
||
[Required] | ||
public string OldText { get; set; } | ||
|
||
[Required] | ||
public string NewText { get; set; } | ||
|
||
|
||
public override bool Execute() | ||
{ | ||
string fileContents = File.ReadAllText(InputFile); | ||
string newLineChars = FileUtilities.DetectNewLineChars(fileContents); | ||
|
||
fileContents = fileContents.Replace(OldText, NewText); | ||
|
||
File.WriteAllText(InputFile, FileUtilities.NormalizeNewLineChars(fileContents, newLineChars)); | ||
|
||
return true; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters