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 6097247
In Process

The Archive Base Latest Questions

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

i have 2 projects in my solution (main is A.WPF and secondary is B.WPF)

  • 0

i have 2 projects in my solution (main is A.WPF and secondary is B.WPF)

when i’m trying to access variables inside my App.xaml.cs in B.WPF:

filename = ((App)Application.Current).ErrorLogFileName;

i get the following error:

Unable to cast object of type 'A.App' to type 'B.App'.

i also tried the following:

filename = ((B.App)Application.Current).ErrorLogFileName;

but still the same error…

the definition in B.App is:

private string _errorLogFileName = "error log.xml";

public string ErrorLogFileName
{
    get { return _errorLogFileName; }
}

please assist…

  • 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-23T13:01:18+00:00Added an answer on May 23, 2026 at 1:01 pm

    Looks like you need to do:

    filename = ((A.App)Application.Current).ErrorLogFileName;
    

    The error is saying the type is A.App, yet in both cases you are trying to cast to B.App.

    There can only be one current application also.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two WIN32 DLL projects in the solution, main.dll should call a function
I have 2 projects in my solution. The first one is a console application,
I am creating solution and inside I have three projects: A WCF Service Library
I have a solution with two executable projects. Main.exe is dependent on Subordinate.exe .
I have 2 C# projects in my solution, both of them DLLs: MyApp.UI.WPF.csproj MyApp.UI.WinForms.csproj
I have a WPF Application project with several project references within a single solution
I have two projects in this solution: ProjectA and ProjectB. ProjectA is the main
I'm developing WinForms application using VS2010. I have about 15 projects in the solution.
Within my main VS solution I have the following 3 projects: The host hosts
I have three c# projects in my solution. One is a console app that

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.