© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
5 replies
swagrid

Run msbuild target only during dotnet pack

Is it possible to run a msbuild target in a csproj only when it's packaged to a nuget package, i.e.
dotnet pack MyProject
dotnet pack MyProject
should cause the target to run while
dotnet build MyProject
dotnet build MyProject
shouldn't.
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

dotnet 8 windows target
C#CC# / help
3y ago
✅ dotnet pack command fails
C#CC# / help
10mo ago
MSBuild doesn't detect files created using Target
C#CC# / help
2y ago
dotnet run throws segfault
C#CC# / help
2y ago