Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Errors when building Inventor 2019 Addin with Visual Studio 2019 and Nifty Addin template

9 REPLIES 9
Reply
Message 1 of 10
JBerns
1311 Views, 9 Replies

Errors when building Inventor 2019 Addin with Visual Studio 2019 and Nifty Addin template

Community,

 

On a new workstation I have installed Windows 10 Pro, Inventor 2019, Visual Studio 2019, and .NET 4.8.

 

When I try to build an addin using @BrianEkins 'Nifty Add-in Inventor 2018' template, a couple of errors are reported, but VS reports a successful build. Please see below:

 

1>------ Build started: Project: Inventor_Addin_2020-11-05_A, Configuration: Debug Any CPU ------
1>  Inventor_Addin_2020-11-05_A -> C:\Users\jberns\source\repos\Inventor_Addin_2020-11-05_A\bin\Debug\Inventor_Addin_2020-11-05_A.dll
1>  '"\VsDevCmd"' is not recognized as an internal or external command, operable program or batch file.
1>  'mt.exe' is not recognized as an internal or external command, operable program or batch file.
1>  C:\Users\jberns\source\repos\Inventor_Addin_2020-11-05_A\Autodesk.Inventor_Addin_2020-11-05_A.Inventor.addin
1>  1 File(s) copied
1>  C:\Users\jberns\source\repos\Inventor_Addin_2020-11-05_A\ButtonResources\SampleButton\16x16.png -> C:\Users\jberns\source\repos\Inventor_Addin_2020-11-05_A\bin\Debug\ButtonResources\SampleButton\16x16.png
1>  C:\Users\jberns\source\repos\Inventor_Addin_2020-11-05_A\ButtonResources\SampleButton\32x32.png -> C:\Users\jberns\source\repos\Inventor_Addin_2020-11-05_A\bin\Debug\ButtonResources\SampleButton\32x32.png
1>  2 File(s) copied
1>  The system cannot find the path specified.
1>  C:\Users\jberns\source\repos\Inventor_Addin_2020-11-05_A\bin\Debug\Autodesk.Inventor_Addin_2020-11-05_A.Inventor.addin -> C:\Users\jberns\AppData\Roaming\Autodesk\ApplicationPlugins\Inventor_Addin_2020-11-05_A\Autodesk.Inventor_Addin_2020-11-05_A.Inventor.addin
1>  C:\Users\jberns\source\repos\Inventor_Addin_2020-11-05_A\bin\Debug\Inventor_Addin_2020-11-05_A.dll -> C:\Users\jberns\AppData\Roaming\Autodesk\ApplicationPlugins\Inventor_Addin_2020-11-05_A\Inventor_Addin_2020-11-05_A.dll
1>  C:\Users\jberns\source\repos\Inventor_Addin_2020-11-05_A\bin\Debug\Inventor_Addin_2020-11-05_A.xml -> C:\Users\jberns\AppData\Roaming\Autodesk\ApplicationPlugins\Inventor_Addin_2020-11-05_A\Inventor_Addin_2020-11-05_A.xml
1>  C:\Users\jberns\source\repos\Inventor_Addin_2020-11-05_A\bin\Debug\ButtonResources\SampleButton\16x16.png -> C:\Users\jberns\AppData\Roaming\Autodesk\ApplicationPlugins\Inventor_Addin_2020-11-05_A\ButtonResources\SampleButton\16x16.png
1>  C:\Users\jberns\source\repos\Inventor_Addin_2020-11-05_A\bin\Debug\ButtonResources\SampleButton\32x32.png -> C:\Users\jberns\AppData\Roaming\Autodesk\ApplicationPlugins\Inventor_Addin_2020-11-05_A\ButtonResources\SampleButton\32x32.png
1>  5 File(s) copied
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

 

1> '"\VsDevCmd"' is not recognized as an internal or external command, operable program or batch file.
1> 'mt.exe' is not recognized as an internal or external command, operable program or batch file.
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

 

When I start Inventor, Addin Manager, the addin reports:

There was an error opening the file.

 

I have run the VsDevCmd.bat file to initialize the system. I have used the '-test' option, to which no errors are reported.

The only 'mt.exe' file on my system is found here:

C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\arm64\mt.exe
C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x64\mt.exe
C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x86\mt.exe

 

I discovered that a User Environment Variable and a System Environment Variable had not been set for VS2019. I added these.

 

2020-11-05_10-42-39.png

 

Any thoughts as to what has not been installed or configured to cause the error for the Inventor addin?

 

Thank you for your time and attention. I look forward to your replies.

 

 

Regards,

Jerry

-----------------------------------------------------------------------------------------
CAD Administrator
Using Inventor 2022
Autodesk Certified Instructor
Autodesk Inventor 2020 Certified Professional
Autodesk AutoCAD 2017 Certified Professional
Labels (3)
9 REPLIES 9
Message 2 of 10
nils.korte
in reply to: JBerns

Hi JBerns,

unfortunately I have exactly the same problem and since your post is already a year old, I wanted to ask if you might have found a solution to it after all.

 

With kind regards.

Message 3 of 10
JBerns
in reply to: JBerns

@nils.korte,

 

I followed a #KETIV #AVA video ( https://www.youtube.com/watch?v=QROrJdg0NQ8 ) to build an Addin.

This time I used .NET 4.7 as shown in the video. Perhaps that was the problem I had earlier because I used 4.8

 

The video creates a new part. That part was successful. No errors. Addin works.

 

I tried to expand the Addin by using a form to ask the dimensions of a box for the new part, but have been unsuccessful.

 

For what its worth, I have attached the project in case someone wants to see where I have gone wrong. I compressed the VS solution folder and attached.

 

The (first) error occurs in the StandardAddInServer.vb file, subroutine m_sampleButton_OnExecute. 

I try to set textbox values for the box position and dimensions, but I get an error:

 

     System.NullReferenceException: 'Object reference not set to an instance of an object.'

 

I am confident I have not allowed the class and the form to communicate correctly.

 

I am focusing on DLL interfaces for now, but hope to find a solution to addin errors.

 

 

Regards,

Jerry

-----------------------------------------------------------------------------------------
CAD Administrator
Using Inventor 2022
Autodesk Certified Instructor
Autodesk Inventor 2020 Certified Professional
Autodesk AutoCAD 2017 Certified Professional
Message 4 of 10
bradeneuropeArthur
in reply to: JBerns

Does the msgbox rise?

bradeneuropeArthur_0-1627583559319.png

 

Regards,

Arthur Knoors

Autodesk Affiliations:

Autodesk Software:Inventor Professional 2024 | Vault Professional 2022 | Autocad Mechanical 2022
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!


! For administrative reasons, please mark a "Solution as solved" when the issue is solved !

Message 5 of 10
JBerns
in reply to: JBerns

@bradeneuropeArthur,

 

Yes, the message does appear.

After the message box is closed, I then attempt to populate the form with values before showing it.

That is when the error occurs.

2021-07-29_16-53-44.png

I can 'Continue' past the error and the form does appear, but without any values that I attempted to preset.

I suspect my lack of knowledge on making the class and the form communicate with each other is the problem.

 

Regards,

Jerry

-----------------------------------------------------------------------------------------
CAD Administrator
Using Inventor 2022
Autodesk Certified Instructor
Autodesk Inventor 2020 Certified Professional
Autodesk AutoCAD 2017 Certified Professional
Message 6 of 10
nils.korte
in reply to: JBerns

Hello,
thank you for the answer. I was able to solve the problems with the \VsDevCmd.bat and the mt.exe.

-----
I changed the second line of the builder events to: call "%VSAPPIDDIR%..\Tools\vsdevcmd"

I also reinstalled the mt.exe via Windows SDK for Windows Store Apps Tools-x86_en-us.msi
I also deleted the last but one paragraph of the builder events, because it tried to delete a folder that does not exist.
-----
Visual Studios does not show me any errors after building, but unfortunately Inventor still cannot launch the add-in.

Inventor permanently shows "There was an error opening the file".


I tried to load the add-in manually into Inventor, i.e. without the builder events. Unfortunately, that didn't work either.
It seems to me that there is another error in the template.

Message 7 of 10
JBerns
in reply to: nils.korte

@nils.korte,

 

Are you using Brian Ekins' Nifty Add-in Template? Especially, the update he posted:

https://ekinssolutions.com/nifty_addin_template/   

 

Regards,

Jerry

-----------------------------------------------------------------------------------------
CAD Administrator
Using Inventor 2022
Autodesk Certified Instructor
Autodesk Inventor 2020 Certified Professional
Autodesk AutoCAD 2017 Certified Professional
Message 8 of 10
nils.korte
in reply to: JBerns

Yes, I've downloaded it from that post.
Message 9 of 10
JBerns
in reply to: nils.korte

Update:

 

I discovered the Build Events instructions contained a reference to VS2017.

 

     REM - Set up the environment.
     call "%VS150COMNTOOLS%\VsDevCmd"

 

I corrected to use VS2019 system variables

 

     REM - Set up the environment.

     call "%VS160COMNTOOLS%\VsDevCmd"

 

No more errors related to VsDevCmd or Mt.

 

Regards,

Jerry
call "%VS160COMNTOOLS%\VsDevCmd"

-----------------------------------------------------------------------------------------
CAD Administrator
Using Inventor 2022
Autodesk Certified Instructor
Autodesk Inventor 2020 Certified Professional
Autodesk AutoCAD 2017 Certified Professional
Message 10 of 10
alain_miltenburg
in reply to: JBerns

The following line will make calling VsDevCmd.bat Visual Studio version independant:

for /f "usebackq delims=#" %%a in (`"%programfiles(x86)%\Microsoft Visual Studio\Installer\vswhere" -latest -property installationPath`) do call "%%a\Common7\Tools\VsDevCmd.bat"

 

When testing this on a command line, you should replace both instances of %%a with %a.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report