-
Notifications
You must be signed in to change notification settings - Fork 134
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
Fail to build a WPF app with PublishTrimmed = true #674
Comments
@Symbai are you able to share a repro? |
@sbomer Yes, it only happens when referencing third party controls. I'm using VS Preview 16.3.0 |
Cecil is tripping over an obfuscated PE file that has an invalid debug directory:
|
Is there a way to exclude it from trimming? |
@Symbai as a workaround you can do the following (we will make this easier in the future): <Target Name="ExcludeAssembliesFromLinking"
BeforeTargets="_ComputeManagedAssembliesToLink">
<ItemGroup>
<_RemovedPublishFiles Include="@(ResolvedFileToPublish)" Condition="'%(Filename)' == 'ActiproSoftware.Grids.Wpf'" />
<ResolvedFileToPublish Remove="@(_RemovedPublishFiles)" />
</ItemGroup>
</Target>
<Target Name="IncludeUnlinkedAssemblies"
AfterTargets="ILLink">
<ItemGroup>
<ResolvedFileToPublish Include="@(_RemovedPublishFiles)" />
</ItemGroup>
</Target> With this you will hit an issue with R2R, because the skipped assembly references <ItemGroup>
<TrimmerRootAssembly Include="mscorlib" />
</ItemGroup> That gets around the issues. You'll also need to add a similar root for |
@sbomer Ok thank you, I'll go with it. I also think that making it easier is a great idea because its a third party control I have no control over the obfuscation. Something like this may happen quite often for other developers as well. I think this can be closed or should I leave this open? |
We're also running into this issue.
It looks like it's because of the following reference: <PackageReference Include="PropertyChanged.Fody" Version="2.6.0"/> I tried the workaround posted above, changing the also I'm using |
@gojanpaolo that looks like a separate issue - would you be able to file a new issue for this? |
I just had the same error message as @gojanpaolo when using Fody. I couldn't find another issue so I'm posting this here in case someone has the same problem. Updating Fody to at least 6.0.4 as described |
I'm using a daily SDK downloaded yesterday with version 3.0.0-preview8-27919-09. Using dotnet publish to build a WPF app with PublishTrimmed = true fails
dotnet publish -c Release -v q --self-contained -r win-x64 -f netcoreapp3.0
with exception
dotnet --info
The text was updated successfully, but these errors were encountered: