BeforeBuild/AfterBuild targets not honored.
See original GitHub issueSteps to reproduce
Requires a project with the following
...
<Target Name="BeforeBuild">
<Message Text="Some message." />
</Target>
...
Then
dotnet restore
dotnet build
Expected behavior
I expect the BeforeBuild
target to be executed. Even adding BeforeTargets="Build"
doesn’t work. Similarly for AfterBuild
/DependsOnTargets="Build"
.
Actual behavior
The target isn’t run.
Environment data
dotnet --info
output:
.NET Command Line Tools (1.0.0-rc4-004771)
Product Information:
Version: 1.0.0-rc4-004771
Commit SHA-1 hash: 4228198f0e
Runtime Environment:
OS Name: ubuntu
OS Version: 14.04
OS Platform: Linux
RID: ubuntu.14.04-x64
Base Path: /usr/share/dotnet/sdk/1.0.0-rc4-004771
Issue Analytics
- State:
- Created 7 years ago
- Reactions:5
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Target BeforeBuild doesn't work in csproj
BeforeBuild dosen't working in csproj. That because Before/AfterTarget in csproj gets overridden by SDKs target file.
Read more >Define a pre-build command without creating a new target
I'm struggling to define a fixed pre-build command for a target. ... I cannot immediately spot the problem without a working example.
Read more >Extend the build process - MSBuild
The Visual Studio build process is defined by a series of MSBuild .targets files that are imported into your project file.
Read more >Sencha Ext JS: Beyond ES5
It allows for configuring -before-build / -after-build targets (you can read more about it here). You can make use of delorean by configuring ......
Read more >How do I run a script before compiling a project? - FAQ
Before compiling the project, I need to run the generate.sh or generate.bat script each time, which first compresses the file data and then ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Try this:
The .NET Core SDK is not, AFAIK, bringing forward the
BeforeBuild
/AfterBuild
extensibility model since the same behavior can be provided by MSBuild’sBeforeTargets
/AfterTargets
attributes, as exemplified above.This one is also interesting: https://github.com/microsoft/msbuild/issues/1680#issuecomment-468710590
While
<BeforeBuild>
and<AfterBuild>
do not work, oddly, these work fine: