TeamsFx: Visual Studio project name too long for manifest validation
When you are working with the Teams Toolkit for Visual Studio and you are using a long project name, you might run into an issue when you want to package your application for deployment. The error message is helpful if you already have some experience with the Teams manifest, but it might be confusing for new developers. The error message we are discussing today is: (×) Error: /name/short must NOT have more than 30 characters
Why is that error happening?
The error message is telling you that the project name is too long for the Teams manifest. The Teams manifest is a JSON file that describes the capabilities of your Teams application. It is used by the Teams client to understand what your application can do and how it should be displayed. The manifest is part of the package that you upload to the Teams App Store or that you sideload into your Teams client. The manifest file has a maximum length of 30 characters for the name/short
property. If your project name is longer than 30 characters, the Teams Toolkit will not be able to validate your manifest file and you will see this error message.
Why is that even bothering us?
If you just create a new project in Visual Studio and you are not aware of the Teams manifest, you might not even notice that your project name is too long. If you create a solution and the teams capability is just a part of your feature set you might need to follow some kind of naming convention for your projects. In my case I like to split projects and name them like Solution.Project
or Solution.Feature
or someting along those lines. This is a common pattern in the dotnet world and it is also a good practice to keep your projects organized and maintainable. My current project name is CommunityBotForOneDrive.TeamsBot
. In my solution there is a project called CommunityBotForOneDrive.Core
and a project called CommunityBotForOneDrive.TestConsole
.
The Teams Toolkit has an initial check for the project name and will show you an error if the project name is too long already at the create new project dialog. But of course, you can just right click the project and rename it to something longer than 30 characters. This is where the error message will show up the next time you want to package your application for deployment or click the Prepare Teams App Dependecies button in the Teams Toolkit menu.
How to fix it?
The fix is simple: Just rename your project to something shorter in the manifest file. The Visual Studio project name is not hardwired to the teams manifest file, it is only used during the scaffolding of your project. You can change the project name in Visual Studio afterwards to something that follows your naming convention but you need to adhere to the 30 character limit for the name/short
property in the Teams manifest file.
So it is more a question of sequence to follow if you never want to see that error:
- Create a new project in Visual Studio and make sure the project name is shorter than 30 characters.
- Change the project name in Visual Studio to something that follows your naming convention.
- Change the
name/short
property in the Teams manifest file to something with less than 30 characters. - Continue with your next step in the Teams FX development process, most probably click the Prepare Teams App Dependencies button in the Teams Toolkit menu.
That’s of course an ideal scenario and it might not always play out that way. So if you just setup your project and prepare all the dependencies and the base structure and infrastrucutre you might forget about that name/short
limit in the manifest. But now you know what to do if you see that error message. Just go back to the manifest file and change the name/short
property to something shorter and you are good to go.
If you need more help with the Teams Toolkit, you can check out the Debug your Teams app locally using Visual Studio guide, the official Teams Toolkit documentation or you can ask your question in the Github repo of Teams Toolkit.