-
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
Log an error if MSBuildProjectExtensionsPath is modified after it is used #3059
Changes from 3 commits
2c1e4ea
7397e1b
5b8e22f
835980b
ef58539
4b5f6c3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -766,6 +766,31 @@ Copyright (C) Microsoft Corporation. All rights reserved. | |
<PropertyGroup Condition="'$(Prefer32Bit)' == 'true' and ('$(PlatformTarget)' == 'AnyCPU' or '$(PlatformTarget)' == '') and '$(PlatformTargetAsMSBuildArchitectureExplicitlySet)' != 'true'"> | ||
<PlatformTargetAsMSBuildArchitecture>x86</PlatformTargetAsMSBuildArchitecture> | ||
</PropertyGroup> | ||
|
||
<!-- | ||
Log an error if the user set MSBuildProjectExtensionsPath in the body of a project. In an SDK style project | ||
if you set a value in the body, the value is not used by the top implicit import but is used by the bottom. | ||
This can lead to confusing behavior and builds can fail for obscure reasons. | ||
--> | ||
<Error Condition=" '$(_InitialMSBuildProjectExtensionsPath)' != '' And '$(MSBuildProjectExtensionsPath)' != '$(_InitialMSBuildProjectExtensionsPath)' " | ||
Code="MSB3540" | ||
Text="The value of the property "MSBuildProjectExtensionsPath" was modified after it was used by MSBuild which can lead to unexpected build results. To set this property, you must do so before Microsoft.Common.props is imported, for example by using Directory.Build.props. For more information, please visit https://go.microsoft.com/fwlink/?linkid=869650" | ||
/> | ||
|
||
<!-- | ||
Log a warning if: | ||
1. $(EnableBaseIntermediateOutputPathMismatchWarning) is 'true' | ||
2. $(BaseIntermediateOutputPath) was set in the body of a project after its default value was set in Microsoft.Common.props | ||
3. $(BaseIntermediateOutputPath) is not the same as $(MSBuildProjectExtensionsPath) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider disabling the warning if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you'd get the error that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The scenario I'm thinking of is that you set |
||
|
||
Similar to the error above, there are cases when users set $(BaseIntermediateOutputPath) in the body of their project and things build but only by coincidence. | ||
MSBuild does not know if $(BaseIntermediateOutputPath) changing would cause problems so tools like NuGet must set $(EnableBaseIntermediateOutputPathMismatchWarning) | ||
to 'true'. | ||
--> | ||
<Warning Condition=" '$(EnableBaseIntermediateOutputPathMismatchWarning)' == 'true' And '$(_InitialBaseIntermediateOutputPath)' != '$(BaseIntermediateOutputPath)' And '$(BaseIntermediateOutputPath)' != '$(MSBuildProjectExtensionsPath)' " | ||
Code="MSB3539" | ||
Text="The value of the property "BaseIntermediateOutputPath" was modified after it was used by MSBuild which can lead to unexpected build results. Tools such as NuGet will write outputs to the path specified by the "MSBuildProjectExtensionsPath" instead. To set this property, you must do so before Microsoft.Common.props is imported, for example by using Directory.Build.props. For more information, please visit https://go.microsoft.com/fwlink/?linkid=869650" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd try rewording this message. The only unexpected build results that I think we're aware of (once we get these changes in) is that output might be written to a path you don't expect. So I'd avoid being unnecessarily vague. I'd suggest something like this:
I'd also suggest using an aka.ms link here (the same one as above). |
||
/> | ||
</Target> | ||
|
||
<!-- | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using an aka.ms link instead of a fwlink. That way you can choose a URL that's more type-able and remember-able.