none
How can I set a template so that the Assembly name matches the project name on creation?

    Question

  • I am currently writing many mods for GTAV, so I have built a template that constructs the basic skeleton required. Everything works fine apart from the Assembly name. No matter what I set the project name to, it always uses the name of the Template for the Assembly name and not the project name. The NameSpace uses the project name correctly, so I'm not sure why the Assembly doesn't.

    Does anyone have a suggestion as to how I can change it so that the Assembly name inherits the Project name?

    Thanks
    Lee


    Worms Forts 10/10, MotoGP3 10/10, Worms 10/10, Rogue Trooper 10/10 - Thank you Total Mobile :D

    Wednesday, April 13, 2016 2:32 PM

Answers

  • The correct and only answer to this questions is: You can't

    Visual Studio will allow projects other than Class Library projects to inherit the Assembly Name from the Project Name. I haven't tested every project type, but WinForms definitely does. Class Library projects will always set the Assembly Name based on the template name the project is based on.

    For example:

    A WinForms project named MyNewProject based on a template called MyProjectTemplate will have an Assembly Name of  MyNewProject.

    A Class Library project named MyNewProject based on a template called MyProjectTemplate will have an Assembly Name of  MyProjectTemplate.


    Worms Forts 10/10, MotoGP3 10/10, Worms 10/10, Rogue Trooper 10/10 - Thank you Total Mobile :D

    • Marked as answer by LeeC22 Thursday, April 21, 2016 1:18 PM
    Thursday, April 21, 2016 1:18 PM

All replies

  • Hi LeeC22,

    Thank you for posting in MSDN forum.

    Normally, the Assembly Name defaults to the project name.

    Refer to:

    https://msdn.microsoft.com/en-us/library/f0c12ze9%28v=vs.90%29.aspx?f=255&MSPPError=-2147217396

    For your question, I try to reproduce it, so I create a new Template and rename the Assembly name and the NameSpace , the result is the same as yours:

    The namespace follow the project name correctly but the Assembly name doesn’t. It’s designed by default in VS

    So if you need to make Assembly name inherit the Project name, you need to manually change it in Properties.

    Best Regards,

    Lake Xiao


    Thursday, April 14, 2016 8:11 AM
    Moderator
  • Please don't take the following as a personal rant/comment, this is aimed at Microsoft...

    That makes no sense... What is the point of a template system, if that system doesn't actually work like a proper template system? You expect the application to handle templates consistently, like if I create a Word template, it operates just like a default Word template.

    Have they done this as a penalty for VS Community being free? I can see no logical reason to block this one function and cause no amount of problems for the end user. I mean, I only discovered this after compiling a mod and discovering that it was going to overwrite another mod, because it was creating a .dll with the exact same name, even though the project name was different.

    So what we have, is a destructive limitation, which is a very bad thing in my opinion. You can't even override it by modifying the csproj file in the template as it reports that "The Compressed (zipped) Folder is invalid or corrupted".

    That means they are really going out of their way to ensure this is inconvenient and not fixable. I don't understand why a company trying to encourage developers to get on board, would present them with such a damaging restriction... and by that I mean damaging in the sense that it forces a file overwrite.

    Definitely a kick in the teeth for the development process... it makes user created templates a worthless and crippled feature. I'll continue to try and find a way to hack a solution and if I get anywhere, I will update this thread, as I am sure I am not the only person with this problem.


    Worms Forts 10/10, MotoGP3 10/10, Worms 10/10, Rogue Trooper 10/10 - Thank you Total Mobile :D

    Thursday, April 14, 2016 11:17 AM
  • Hi Lee,

    We reproduced this situation and the result is the same as you said, the Assembly name doesn't matches the project name on creation.

    As far as we know, it is designed by default, i really understand the inconvenience it brings to you.

    In order to improve your development experience, you could submit as a feature request:

    http://visualstudio.uservoice.com/forums/121579-visual-studio

    The Visual Studio product team is listening to user voice there.

    Besides, you can send your idea there so the others can vote it. If you submit this suggestion, you might post that link here which will benefit others who has the similar issue, I will vote it.

    Thanks for your understanding.

    Best Regards,

    Lake Xiao



    Friday, April 15, 2016 2:11 AM
    Moderator
  • Hi Lake,

    I was just in the process of submitting an idea to that forum, when something occurred to me. It was because you said "We reproduced this situation and the result is the same as you said, the Assembly name matches the project name on creation.". whereas my problem is that the Assembly name doesn't match the project name.

    In my haste to complain about this, I had neglected to mention one very important factor... the template I am using is for a Class Library, not a standard Winforms project. As it turns out, this is a significant factor, because Winforms projects inherit the project name correctly, so it must be just the Class Library projects that have the problem.

    Really sorry for causing the confusion by not explaining myself properly. I seem to be having a problem of late, where what I am thinking, does not get translated into writing and I don't always notice. So just to clarify, this is a Class Library issue, not a Winforms project issue.


    Worms Forts 10/10, MotoGP3 10/10, Worms 10/10, Rogue Trooper 10/10 - Thank you Total Mobile :D

    Friday, April 15, 2016 2:39 AM
  • Hi Lee,

     

    So sorry that I missed a word “doesn’t ” in my previous reply, what I want to express about is the same as yours.

    Besides, I have submit the feature requirement, please see:

    https://visualstudio.uservoice.com/forums/121579-visual-studio-2015/suggestions/13431945-i-want-to-set-a-template-so-that-the-assembly-name

    You can vote it and add your comments.

     

    Best Regards,

    Lake Xiao



    Friday, April 15, 2016 5:25 AM
    Moderator
  • Sorry, posting an incorrect submission doesn't answer the question, I have therefore (correctly) unproposed it.The post below this one will have the only correct answer and will be marked as such.

    If there is no answer to the problem, as there isn't in this instance, please don't mark anything as an answer. Especially when the feature requirement you have submitted did not take into account the fact this is Class Library specific, as I had already stated before you made that submission. So not only was it not an answer, it was a wrong non-answer.

    It seems people are far too interested in boosting their points scores on these forums and that is not what proposing an answer is there for. This is a help community, not a contest.


    Worms Forts 10/10, MotoGP3 10/10, Worms 10/10, Rogue Trooper 10/10 - Thank you Total Mobile :D

    Thursday, April 21, 2016 1:12 PM
  • The correct and only answer to this questions is: You can't

    Visual Studio will allow projects other than Class Library projects to inherit the Assembly Name from the Project Name. I haven't tested every project type, but WinForms definitely does. Class Library projects will always set the Assembly Name based on the template name the project is based on.

    For example:

    A WinForms project named MyNewProject based on a template called MyProjectTemplate will have an Assembly Name of  MyNewProject.

    A Class Library project named MyNewProject based on a template called MyProjectTemplate will have an Assembly Name of  MyProjectTemplate.


    Worms Forts 10/10, MotoGP3 10/10, Worms 10/10, Rogue Trooper 10/10 - Thank you Total Mobile :D

    • Marked as answer by LeeC22 Thursday, April 21, 2016 1:18 PM
    Thursday, April 21, 2016 1:18 PM