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

  • Home
  • SEARCH
  • 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 743285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T08:50:44+00:00 2026-05-14T08:50:44+00:00

I have found myself countless times reorganizing our solution (72 + projects), in efforts

  • 0

I have found myself countless times reorganizing our solution (72 + projects), in efforts to reduce code. A lot of times it involves pulling out common types/libraries and moving them around.

It always involves a reptitive compiler error so i am having to fix the same compiler error in a lot of different places. I am looking for a guide to the VS api so i can do some code generation/automated fixing.

Even if you dont have the exact solution, can you please point me to where i should look? Is there a compiler api? refactor api? Any suggestions on how i can do either one?

Use Cases:

So first question (easiest of the two):

Automated fixing when i move a file from one project to another. This process would be to find the error

“The type or namespace name ‘MovedClass’ could not be found.

Then remove the old namespace, add the new, and add the project reference.

Case Two… refactoring to a pattern.

Example:

Original Base VO Class:

   public class BaseVO{
      public AuditInfo { get;set;}

   }
   public class BaseKey{

   }

All of our Business Objects(each in individual class).

   public class ExampleBusinessVO : BaseVO{
      public AuditInfo { get;set;}
      public ExampleBusinessKey BusinessKey { get;set;}
   }

   public class ExampleBusinessKey{


   }


Now assume we want to add an explicit link between BaseVO and Base Key, and force all to implement Equals/HashCode

New Base VO Class:

   public abstract class BaseVO<TKey>{
      TKey BusinessKey{get;set;}
      public abstract override bool Equals(object obj);          
      public abstract override int GetHashCode();

   }
   public class BaseKey{

   }

All then i must cascade these changes to all VOs. (ouch )

   //Add generic
   public class ExampleBusinessVO : BaseVO<ExampleBusinessKey>{
       //Remove old business key  

        //Implement methods
       public override bool Equals(object obj){

       }
   }

   public class ExampleBusinessKey: BaseKey{


   }

Now i recognize i can’t fix all of the errors, but it would be nice to be able to write something to check a class for the compile errors. Then i could develop a pragmatic solution:

For each of the VOs if error: “Using the generic type … requires 1 type argument”, then read the class file and find the class that implements BaseKey, and then add it to the template method.

Please note i am looking for an automated solution not a refactoring tool

  • 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-14T08:50:44+00:00Added an answer on May 14, 2026 at 8:50 am

    Personally, I would recommend ReSharper as it provides functions for most of the refactoring work you might need.

    Moving types (even between projects), renaming types, extracting methods, reordering method signatures, etc…

    It is a paid solution, but well worth your money (or your employer’s). You can download a free trial from the site that is fully functional to get a feel for it.

    EDIT:

    Ok, so I just tested this out, and ReSharper will take care of all the work needed to move one type to another project, but it doesn’t automatically add references for you. However, it does give you fair warning that new references will be needed, and adding those references is pretty darn simple using ReSharper:

    Add Reference With Resharper

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

Sidebar

Related Questions

I have found myself doing this in my code to 'cache' the work done
I have found myself having to turn a chunk of Lua code into a
i have found myself several times in the need of knowing the last values
While fleshing out a hypothetical domain model, I have found myself wondering whether the
I'm currently working on project with Haskell, and have found myself some trouble. I'm
Recently, I found myself having to write up some concerns I have about race
I have found myself designing a language for fun that is a cross between
I have found myself writing the same view over and over. It is basically
I have found myself with at little problem, and I think a custom model
Recently I have found myself using StringBuilder for all string concatenations, big and small,

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.