Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6018151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:14:01+00:00 2026-05-23T03:14:01+00:00

I’m writing this code in a Console Application targeting the .NET Framework 4 Client

  • 0

I’m writing this code in a Console Application targeting the .NET Framework 4 Client Profile.

this.container.AddFacility<LoggingFacility>(
  f => f.LogUsing(LoggerImplementation.Log4net));

When it runs, it fails with a type conversion error.

Could not convert from ‘Castle.Services.Logging.Log4netIntegration.Log4netFactory,Castle.Services.Logging.Log4netIntegration,Version=2.5.1.0,
Culture=neutral,PublicKeyToken=407dd0808d44fbdc’
to System.Type – Maybe type could not
be found

This is because the Castle.Services.Logging.log4netIntegration assembly is not copied to the output folder. As an runtime-only dependency, this doesn’t break the build.

Looking at the build process, I found that it was not copying log4net or the Castle facility assembly because they depend on System.Web which is not available in the Client Profile. Changing to the standard profile means that this dependency is available and the facility can be added.

Why is this be done? What difference does it make that I am not targeting the client profile in a console application designed to be used as a scheduled task on a server?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T03:14:02+00:00Added an answer on May 23, 2026 at 3:14 am

    Some of the appenders depend on System.Web such as the AspNetTraceAppender. The only other option available to the developers would have been to split out components that don’t depend on the System core into separate assemblies but that would have broken the beauty of log4net in that it is so simple to use. Additionally at the time of writing log4net I don’t believe there was such a thing as a Client Profile.

    Since log4net is open source there is nothing stopping you from downloading the source and removing the offending classes and creating your own Client Profile centric log4net assembly.

    http://www.thecodeking.co.uk/2010/08/making-log4net-work-with-net-client.html

    1. Download the log4net source
    2. Open & upgrade the solution using Visual Studio 2010
    3. Remove the System.Web project reference
    4. Exclude Appender\AspNetTraceAppender.cs class from the project
    5. Add a reference to System.Configuration
    6. Navigate to Project -> log4net properties, and select the application tab
    7. Change the target framework to .NET Framework 3.5 Client Profile
    8. Select the Build tab, and change the configuration to Debug
    9. Under Conditional compilation symbols change this to NET;NET_1_0;NET_2_0;
    10. Change the configuration to Release
    11. Under Conditional compilation symbols change this to STRONG;NET;NET_1_0;NET_2_0;
    12. Edit the AssemblyInfo.cs class and update the AssemblyKeyFile attribute with a valid strong key
    13. Compile the project in Release mode and distribute the new assembly
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.