C
C#12mo ago
skyslide22

✅ How to get build date of a asp.net app?

i want to display the YYYYMMDD in a blazor wasm app, how can i get the build date to display? i have tried this
<PropertyGroup>
<PreBuildEvent>date +"%Y %m %d" > "$(ProjectDir)wwwroot\BuildDate.txt"</PreBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PreBuildEvent>date +"%Y %m %d" > "$(ProjectDir)wwwroot\BuildDate.txt"</PreBuildEvent>
</PropertyGroup>
but that creates a file "\wwwroot\BuildDate.txt", not a file IN wwwroot... ????
5 Replies
boiled goose
boiled goose12mo ago
i used <WriteLinesToFile File="$(ProjectDir)\Properties\BuildDate.txt"
skyslide22
skyslide2212mo ago
how do i access Properties then in c#? i have seen mutliple examples with that but nowhere a hint where Properties comes from, no namespace named
boiled goose
boiled goose12mo ago
you mean the settings? you should create a settings file
Accord
Accord12mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
skyslide22
skyslide2212mo ago
found my solution
<PropertyGroup>
<PreBuildEvent>date +"%Y %m %d" > $(pwd)/Client/wwwroot/BuildDate.txt</PreBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PreBuildEvent>date +"%Y %m %d" > $(pwd)/Client/wwwroot/BuildDate.txt</PreBuildEvent>
</PropertyGroup>