-
Notifications
You must be signed in to change notification settings - Fork 26
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
PublishSingleFile causes Target symbol-name is unknown: 'RichTextBox' #99
Comments
Hi, Could you please try this? |
I added this one code line
at the very beginning of the program.cs main method and exchanged 'MyAssembly' with my Assembly name. |
Maybe try this: NLog.LogManager.Setup().SetupExtensions(s => s.RegisterAssembly(typeof(NLog.Windows.Forms.RichTextBoxTarget).Assembly)); |
yes, this works. However we have 20 Projects and try to keep it as 'tidy' as possible. In case it would be possible to fix the issue within the future version of nlog windows forms library, it would be great. System.Configuration.ConfigurationManager had a similiar problem and fixed it with version 6.0.0 btw. |
Have you tried to explicit include the Assembly in your <nlog>
<extensions>
<add assembly="NLog.Windows.Forms"/>
</extensions> |
No, my nlog.config does not include any extension entries.
Holen Sie sich Outlook für Android<https://aka.ms/AAb9ysg>
…________________________________
From: Rolf Kristensen ***@***.***>
Sent: Saturday, March 26, 2022 11:27:44 PM
To: NLog/NLog.Windows.Forms ***@***.***>
Cc: lionengine123 ***@***.***>; Author ***@***.***>
Subject: Re: [NLog/NLog.Windows.Forms] PublishSingleFile causes Target symbol-name is unknown: 'RichTextBox' (Issue #99)
Does your NLog.config include:
<nlog>
<extensions>
<add assembly="NLog.Windows.Forms"/>
</extensions>
—
Reply to this email directly, view it on GitHub<#99 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AXEDVSVKL2A47TUBWIW2C6LVB6FOBANCNFSM5RQSXD7Q>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
You can replace the explict Notice NLog 5.0 will no longer scan and load NLog-extension-assemblies automatically. Instead NLog-extension-assemblies must always be explicitly specified. But NLog 5.0 also introduces support for specifying assembly-name in target-type: <target xsi:type="RichTextBox, NLog.Windows.Forms" name="myRichTextBox" ... /> |
Thank you this also works. (So no code changes aka 'RegisterAssembly' necessary.) |
Adding was not sufficient (/ is not needed) when publishing as single file.
(Tested with 5.0.0-rc2) |
NLog InternalLogger looks like this on my machine, and it just works with NLog 5.0-RC2:
If I just use |
This thread is all about publishing as single file. |
This is my csproj-file: <PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<UseWindowsForms>true</UseWindowsForms>
<PublishSingleFile>true</PublishSingleFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NLog" Version="5.0.0-rc2" />
</ItemGroup> And this is the command that I was running to perform the publish:
This is the publish-folder: This is the NLog.config: <?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd">
<targets>
<target xsi:type="RichTextBox, NLog.Windows.Forms"
name="target1"
layout="${message}"
autoScroll="true"
maxLines="30"
useDefaultRowColoringRules="true" /> |
Thanks, However we have: (Net5.0)
Perhaps that's where the different behaviour comes from. Your answer:
is already our solution and solves the problem on our side. |
In your Testsetting I realized you are not using a controlName. Do you log into a separate Logging Window? `
... (Net5 <-> Net6 didnt make any difference) |
Think your questions are beyond my skill-set when it comes to the I was mostly interested in whether And yes when using NLog 4.7 with <nlog>
<extensions>
<add assembly="NLog.Windows.Forms"/>
</extensions> |
Closing issue as answered due to inactivity |
Hello,
I use NLog.Windows.Forms (version 4.5.0).
Whenever a Project is published with this property:
<PublishSingleFile>true</PublishSingleFile>
I get such an error: (internalLogfile.log)
I tried the following package constellations:
and
In case I build the project without this PublishSingleFile property, the logging into RichTextBox works fine.
The text was updated successfully, but these errors were encountered: