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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:59:18+00:00 2026-05-11T08:59:18+00:00

I have a question I don’t know if it can be solved. I have

  • 0

I have a question I don’t know if it can be solved. I have one C# project on Visual Studio 2005 and I want to create different DLL names depending on a preprocessor constant. What I have in this moment is the preprocessor constant, two snk files and two assembly’s guid. I also create two configurations (Debug and Debug Preprocessor) and they compile perfectly using the snk and guid appropriate.

#if PREPROCESSOR_CONSTANT [assembly: AssemblyTitle('MyLibraryConstant')] [assembly: AssemblyProduct('MyLibraryConstant')] #else [assembly: AssemblyTitle('MyLibrary')] [assembly: AssemblyProduct('MyLibrary')] #endif 

Now, I have to put the two assemblies into the GAC. The first assembly is added without problems but the second isn’t.

What can I do to create two or more different assemblies from one Visual Studio project?

It’s possible that I forgot to include a new line on ‘AssemblyInfo.cs’ to change the DLL name depending on the preprocessor constant?

  • 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. 2026-05-11T08:59:18+00:00Added an answer on May 11, 2026 at 8:59 am

    Here is a sample Post-Build event:

    if '$(ConfigurationName)' == 'Debug' goto Debug if '$(ConfigurationName)' == 'Release' goto Release  goto End  :Debug del '$(TargetDir)DebugOutput.dll' rename '$(TargetPath)' 'DebugOutput.dll'  :Release del '$(TargetDir)ReleaseOutput.dll' rename '$(TargetPath)' 'ReleaseOutput.dll'  :End 

    Change DebugOutput.dll and ReleaseOutput.dll to the proper filenames. you can change 'Debug' and 'Release' to support other configurations, and add sections to support more configurations.


    That script will create two dlls with different file names; to create two different AssemblyNames, you have two options.

    The assembly name is built as follows:

    Name <,Culture = CultureInfo> <,Version = Major.Minor.Build.Revision> <, StrongName> <,PublicKeyToken> '\0' 

    So you have to either change the culture info, the version or the strong name.

    The two simplest options are:

    1. Change the assembly version:

      #if SOME_COMPILER_SYMBOL [assembly: AssemblyVersion('1.0.0.0')] #else [assembly: AssemblyVersion('1.0.0.1')] #endif 
    2. Change the keyfile – create two keyfiles with the sn tool, and in AssemblyInfo.cs:

      #if SOME_COMPILER_SYMBOL [assembly: AssemblyKeyFile('FirstKey.snk')] #else [assembly: AssemblyKeyFile('SecondKey.snk')] #endif 

    Both these options will result in two different assemblies as far as the GAC knows – since it compares the full assembly name, and not the ‘simple’ name.

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

Sidebar

Related Questions

I don't know if I have all the information needed to phrase this question
Sorry for the basic question - I'm a .NET developer and don't have much
I have a question about best practices regarding how one should approach storing complex
I have question to Java or C# programmers. I want to render some pages
I have a question about the eclipse. I want to write JSP by using
I have some question about DataGridView . I can show table in DataGridView ,
i have one question. I ready many pages about best thereading like this http://www.albahari.com/threading/part4.aspx
I have a question regarding interfaces. I understood that you cannot create instances of
I have question about NSView: Imagine a Custom View where the mouseDown, mouseDrag and
We have the question is there a performance difference between i++ and ++i in

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.