-
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
IncludePackageReferencesDuringMarkupCompilation
causes build errors with WPF projects
#5576
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
@dotnet/roslyn-compiler we weren't sure if this should be transferred to dotnet/sdk or dotnet/wpf; feel free to transfer if it's not a compiler problem. |
@vishalmsft: There are changes in 6.0 that need to be backported to 5.0. |
I finally managed to find a relatively simple fix for this. The problem is, that the WPF two stage compilation process adds The simple fix, make the AssemblyName change conditional in the -<PropertyGroup>
+<PropertyGroup Condition="'$(_TargetAssemblyProjectName)' == ''">
<AssemblyName>$(MSBuildProjectName)</AssemblyName>
</PropertyGroup> Works like a charm for me! |
@las-nsc - Whilst I examine this more closely, would you kindly review this PR that may have resolved this issue? The PR has already been merged and can be found in the latest code. Please test it out and inform us if it resolves the issue, so we can close it. If it does not resolve the issue, I will continue working on it. |
This submission has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 14 days. It will be closed if no further activity occurs within 7 days of this comment. |
The reason for enabling this setting is to include code from a source generator (BoilerPlateZero), but that wasn't needed to cause the build to break.
Version Used:
.NET 5.0-windows with C#9 with VS2019 16.11.0 Enterprise
Steps to Reproduce:
Directory.Build.props
or*.csproj
a.
<AssemblyName>MyProductName.$(MSBuildProjectName)</AssemblyName>
b.
<IncludePackageReferencesDuringMarkupCompilation>true</IncludePackageReferencesDuringMarkupCompilation>
Expected Behavior:
Should build with no errors.
Actual Behavior:
Fails to builds with errors such as:
[ProjectDir]
\bin\Debug\ref\[AssemblyName]
.dll' could not be found.[ProjectDir]
\bin\Debug\[AssemblyName]
.dll' could not be found.[ProjectDir]
\obj\Debug\[AssemblyName]
.dll'.[CustomClass]
'. Note that type names are case sensitive.[CustomClass]
' does not exist in XML namespace 'clr-namespace:[Namespace]
'.NOTE: In all cases, the
[ProjectDir]
/[AssemblyName]
is the same as the source of the error (I assume due to the iterative way WPF is built) and the[CustomClass]
es which aren't found in the[Namespace]
s are also within the same project.This occurs in two separate solutions using
$(MSBuildProjectName)
inAssemblyName
, and the only way I could get it to build was to overrideDirectory.Build.props
with an explicitAssemblyName
tag in the*.csproj
(not using$(MSBuildProjectName)
).I tried to make a sample solution without any private code, but for some reason it was lacking the complexity which causes it to fail, sorry.
The text was updated successfully, but these errors were encountered: