-
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
NuGet package build logic ignored under some obj customizations #2245
Comments
Reported offline by @MikhailArkhipov -- thanks! |
//cc @rohit21agrawal |
Just hit it myself, will this get fixed in the upcoming version of MSBuild? Thanks! |
We're adding an error in common targets if you set BaseIntermediateOutputPath and a warning if you set MSBuildProjectExtensionsPath in the body of a project. |
@jeffkl Why? We need a custom address for "obj" folder, so we need to change it. Also Please don't put something in that folder, if you need put something in it, just give us another property for put an address for another place. What is "obj" folder for? google tell us: The "obj" folder is used to store temporary object files and other files used in order to create the final binary during the compilation process. The "bin" folder is the output folder for complete binaries (assemblies). So please don't cofuse about temporary files and permanent files. We need to separate it, I thought you guys gave us
But after that it told me that's wrong again....Don't know what you guys want to do.... |
@jeffkl , After I removed |
If you're in a situation where you want to customize the obj directory (
IntermediateOutputPath
) path, you may run into a situation where the build ignores packages' .props and .targets files.This happens if you assign a value to
IntermediateOutputPath
after importingMicrosoft.Common.props
, which is easy to do, especially with Sdk imports.The reason this causes silent errors is that NuGet restore happens at the solution level. Restore asks each project for some information, and gets the final value of the obj directory, after the top-to-bottom evaluation of the project, so it gets the customized value. NuGet then generates .props and .targets files in that location.
When the actual build begins,
Microsoft.Common.props
attempts to import the generated file from the default obj location, because at the time of the import, the property hasn't been set to its custom value. No file is present in that location and the build silently continues, with no NuGet-package-delivered customizations.Workaround
Customize the obj directory using
Directory.Build.props
, or another mechanism that setsBaseIntermediateOutputPath
before theMSBuildProjectExtensionsPath
inMicrosoft.Common.props
.📝 Note: doing this means that you do not have access to very many properties that are set to defaults in the imported props. Be careful to use only built-in properties or constants, and not rely on things like
$(AssemblyName)
.The text was updated successfully, but these errors were encountered: