-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
RootNamespace should be set explicitly in WPF inner builds #5697
Comments
I just tested with 7.0.300-preview.23122.5, and only part of the original problem repros.
The above now works. But this part:
is not yet done. Here is my repro project: Just run @Kuldeep-MS thank you for the proposed fix. I don't know how to apply your PR build to my local machine (and sadly, the PR build has been deleted by now anyway). But hopefully the repro project and instructions will help you to validate. |
@AArnott - I ran Reg: Applying fix to your local machine, Please follow the following steps
|
Problem description:
A typical WPF project file does not explicitly set the
RootNamespace
MSBuild property but rather inherits it from the$(MSBuildProjectName)
.WPF's inner build creates a temporary project file with a random suffix added to the project name. This means that the default RootNamespace changes to not match the actual
RootNamespace
from the outer build.Two problems with that:
RootNamespace
in the inner build does not match the value used by the outer build. This may not be a customer facing problem if the inner build does not ever include targets that care what that property is set to.EmbeddedResource
items are embedded using logical names based onRootNamespace
, so as one example if that step is done within an inner build, then the inner build has a corrupted result.RootNamespace
changes to a new random value with each and every build. This breaks incremental build and forces WPF's inner build to actually compile the result with each and every build (with no source changes) when Nerdbank.GitVersioning is installed in the project, since this property serves as an input to a generated source file.See #5458 for other work targeting improving incremental build performance.
Actual behavior:
The
RootNamespace
property is not set in the generated tmpproj.csproj file.Expected behavior:
If
RootNamespace
is explicitly set in the project file, its definition should be copied into the tmpprojIf
RootNamespace
is not explicitly set in the project file, the generated tmpproj should set it explicitly to$(_TargetAssemblyProjectName)
.For example we were able to workaround the problem by adding this to our
Directory.Build.targets
file:The text was updated successfully, but these errors were encountered: