-
Notifications
You must be signed in to change notification settings - Fork 335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Source file pre-processing #204
Comments
Are you thinking something like a simple key/value pair string replace of tokens like |
Simple key/value replacement is min bar but we could go bigger (like T4). It needs to be simple to use, and ideally make sense when in VS as well for both template editing and output viewing. It needs to be dynamic at build. It needs to be batchable. I think if you search for writelinestofile in a few of our repos you can come up with some scenarios. |
+1 We use this in EF to inject the PowerShell module version: @{
ModuleVersion = '%version%'
# ...
} |
Example workaround: <WriteLinesToFile
File="$(TargetDir)EntityFrameworkCore.psd1"
Lines="$([System.IO.File]::ReadAllText('EntityFrameworkCore.psd1.in').Replace('%version%', $(AssemblyVersion)))" /> |
Yeah we have the same sort of hacks in CoreFx / core-setup and that's why I opened this issue. |
I generally just use WriteLinesToFile when I can, but have found that it is problematic when the file content contains We wrote a simple task for pre-processing files in ASP.NET Core. I'd be happy to contribute it. |
See also dotnet/msbuild#4018 |
Let's make this a specific ask 😺: Copy Ideal would be to do this in 'main', 'release/3.x', and 'release/5.0'. I may be able to help w/ but time is tight at the moment. Will wait for triage in any case. |
See also #135 and dotnet/msbuild#4018 |
@alexperovich @markwilkie we need a decision here urgently because using the task from aspnet/BuildTools is incompatible w/ Arcade-powered source build (see dotnet/aspnetcore#32492). If /cc @dotnet/aspnet-build @dseefeld |
I don't see an issue with adding this to arcade. I think it shouldn't be part of arcade.sdk directly though, I would be more in favor of a separate package that enables template functionality with Template items or something. |
Yea, let's do it! (and Alex is correct, it shouldn't be part of the Arcade SDK) |
The MSBuild Any objection to postponing new features such as using item groups for later❔ In any case, @JunTaoLuo let me know if you start working on this before I get to it. Unless of course @markwilkie volunteers someone first😀 |
No preferences on package naming from me.... (and sorry @dougbu, we're full up right now) |
Reopening, @dougbu we want this in 3.1 and 5.0 as well right? |
It would be amazing to remove our last aspnet/BuildTools dependency in those branches😀 But, back-porting is up to @markwilkie |
Seems like a good thing to do to backport. Thoughts @mmitche ? |
Fine by me if it helps get rid of some legacy infra. |
Do we still care about backporting this to 5.0/3.1? |
No |
I've found myself numerous times needing to do some simple source preprocessing.
I'll often resort to readlinesfromfile|File.readalltext/writelinestofile with a few replacements. This type of hack is an abomination. We should have a general purpose text pre-processing task at the least. Ideally we do that and define some item/target semantics for doing something with the preprocessed item.
/cc @weshaggard
The text was updated successfully, but these errors were encountered: