My First revit plugin

My First revit plugin

npmagalhaes
Contributor Contributor
1,414 Views
11 Replies
Message 1 of 12

My First revit plugin

npmagalhaes
Contributor
Contributor

How can I buid a dll file? I shoose a .NET 4.8 framework, I'm using a C# and Visual studio comunity 2019, but something goes wrong! 

0 Likes
Accepted solutions (1)
1,415 Views
11 Replies
Replies (11)
Message 2 of 12

prasannamurumkar
Advocate
Advocate

 

You Could start with building simple program then move to complex.

For revit plugin You require addin file,Revit api references,Also remember the versions.

Whenever You get any error you could search same error just by copy pasting on google  most probably you get answers.

If not ask on forum with specifying error and explain the step by step reproducible case mostly you get answer from experts.

You could learn from SDK  PDF  Where step by step explanations  is given to build application.

 

 

Message 3 of 12

npmagalhaes
Contributor
Contributor
I investigate and explore. I will read the document, and I feedback soon
0 Likes
Message 4 of 12

caroline.gitonga
Autodesk
Autodesk

Hi @npmagalhaes ,

I am also new in Revit API and just completed My First Plugin Plugin blog guideline. You can explain further what problem you are facing and you will get the help you need. 

All the best getting in Revit API.

Carol Gitonga, Developer Advocacy and Support, ADN Open
0 Likes
Message 5 of 12

npmagalhaes
Contributor
Contributor
Hi Caroline, where can I find your blog guide line?
0 Likes
Message 6 of 12

caroline.gitonga
Autodesk
Autodesk

Hi @npmagalhaes ,

My First Revit Plug-in Overview 

Here is the link to a detailed overview on how to package Revit applications when getting started with Revit API: from well explained code, building your code, debugging, creating manifest .addin file and launching your commands on Revit UI. The blog is very simple and very detailed to help you get through basic concepts in Revit API development.

My First Revit Plug-in Overview 

Take a look, and raise a query when u get stuck or get an issue

Carol Gitonga, Developer Advocacy and Support, ADN Open
0 Likes
Message 7 of 12

npmagalhaes
Contributor
Contributor

Hi Carolina, 

 

I complete the lesson1. And it happen this on Revit 2022

 

npmagalhaes_0-1644532314673.png

Do you know why? ando what I do Wrong?

 

 

0 Likes
Message 8 of 12

stever66
Advisor
Advisor

Can you post your code, and the text from the add-in file?

0 Likes
Message 9 of 12

caroline.gitonga
Autodesk
Autodesk

Hello @npmagalhaes , 

This error as clear as it is means that you have not referenced the right class name on The FullClassName tag in your manifest .addin file. Check your project namespace and class name using this convention: Namespace.Classname

Carol Gitonga, Developer Advocacy and Support, ADN Open
0 Likes
Message 10 of 12

npmagalhaes
Contributor
Contributor
what do you mean?
"Check your project namespace and class name using this convention: Namespace.Classname"
I have this on my project:
namespace Lab1PlaceGroup
{
[Transaction(TransactionMode.Manual)]
[Regeneration(RegenerationOption.Manual)]
public class class1 : IExternalCommand
{
On the manifest addinI have this:
<FullClassName>Lab1PlaceGroup.Class1</FullClassName>


0 Likes
Message 11 of 12

caroline.gitonga
Autodesk
Autodesk

Hello @npmagalhaes ,

 

Thank you for the follow up on this issue. Your .addin file FullClassName tag seems fine to me.

I had encountered the same error you are facing just a few days ago, I went through this article for troubleshooting my code. Maybe you could have a look first and see if you could get a solution.

Troubleshooting .addin Revit File 

It seems your .addin file is referencing the wrong assembly .dll file probably from some other projects within your computer you had recently build before. You also, close up all the visual studio projects and re-open the only project you are dealing with, perform a fresh build and launch your addin. 

Also, make sure you:

  • Note: You should always set the Copy Local property of RevitAPI.dll to false for new projects. This saves disk space, and prevents the Visual Studio debugger from getting confused about which copy of the DLL to use. Right-click the RevitAPI.dll, select Properties, and change the Copy Local setting from true (the default) to false.

If the issue persists kindly share minimum reproducible case of your code and .addin file.

 

 

Carol Gitonga, Developer Advocacy and Support, ADN Open
0 Likes
Message 12 of 12

caroline.gitonga
Autodesk
Autodesk
Accepted solution

Hi @npmagalhaes,

namespace Lab1PlaceGroup
{
[Transaction(TransactionMode.Manual)]
[Regeneration(RegenerationOption.Manual)]
public class class1 : IExternalCommand
{
On the manifest addinI have this:
<FullClassName>Lab1PlaceGroup.Class1</FullClassName>

From the sample code you provided above, your class is class1, but the class you have referenced on you .addin file is Class1. (casesensitive)

Revit cant get the Class1 because your class is class1. so your .addin file should be:

<FullClassName>Lab1PlaceGroup.class1</FullClassName>

 

 

Carol Gitonga, Developer Advocacy and Support, ADN Open