-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Customizing SDK style builds #3410
Comments
Okay, I think I figured it out. It seems that all that Sdk="Microsoft.NET.Sdk" is doing for me is adding those Imports, so I can just replace that with an explicit import instead:
I only realized this after I saw that the Import element now has an "Sdk" attribute (thanks Intellisense). Is this really all the Sdk attribute on Project is doing? |
@MarkPflug If you want your override targets to apply to more than just one project, you may want to put them in a Directory.Build.targets file in the root of your repo. It will automatically be imported after the common targets, and you don't have to change your projects to use explicit SDK imports. See Customize your build for more information. |
@dsplaisted - unfortunately, However, the And from there, most of the Microsoft.NET.Sdk's .targets files get imported after So if you want to override things after a SDK's .targets files, your only real option is to explicitly import the SDK.targets file. 😞 |
Thanks for the suggestions guys. I've got things working acceptably well now. One thing I'd suggest for documentation improvement, add a link from What's New In MSBuild 15.0 directly to How to: Use MSBuild Project SDKs. That SDK topic is under "MSBuild Targets", which I didn't bother exploring, because I (thought I) knew all about how targets work. Honestly, the SDK feature feels like it should be its own top-level topic. |
@Mikejo5000 Feedback on doc organization ☝. Thoughts on making those changes? I'm not sure SDKs deserves a top-level feature, but user feedback is important. |
@rainersigwald I'll add the link from What's New. Bumping up the topic to a higher TOC level seems like it would require the addition of a new TOC node such as "MSBuild Projects", but then we'd need to add new content on projects to make sense of it. |
I have a question regarding customizing SDK style projects. In old-style projects, I could redefine any standard Target that I wanted, by placing my own definition after the Import for "Microsoft.CSharp.targets". However, with the new SDK style projects the SDK.targets is implicitly added to the very end of my project file, so there is no "after" for me to include my redefinitions. Is there a way to do this with SDK style projects, or is this simply no longer an option?
The text was updated successfully, but these errors were encountered: