Revit Custom Addin - Solution with one project or multiple projects? - c#

At the beginning my Revit Addin had only one project in Visual Studio but with the time I added more and more projects and per project always a new Addin (*.addin file) was created.
My question here is: Is there a best practice for this? Does one make several individual projects or does it bring from the performance in Revit something if only one large Addin project make?
In summary:
several *.dll and *.addin files
a single *.dll and *.addin file
as an addin?
Before I start to restructure my whole solution with several projects into one project, I wanted to ask if there are any advantages or disadvantages?

Yes. There are advantages and disadvantages. For an extreme example and some sample code that you can use if you want to decide to go for the single DLL and add-in manifest solution, take a look at the RvtSamples Revit SDK sample:
Revit Developer Centre
The Building Coder on RvtSamples
I implemented it as an external application. On startup, it reads one single text file listing over a hundred DLLs containing external command implementations and populates a menu with all of them grouped into different categories. When you click on a menu entry, the corresponding external command is loaded and executed.
Here is a log of some of the development steps. For your specific requirements, you may want to pay particular attention to the include file idea:
Loading SDK Samples
Loading The Building Coder Samples
Porting the Building Coder Samples
Debugging with Visual Studio 2010 and RvtSamples
Migrating the Building Coder Samples to Revit 2012
Compiling the Revit 2014 SDK
RvtSamples for Revit 2017
The Building Coder Samples 2017
Close Doc and Zero Doc RvtSamples

Related

Converting PDF to Excel with C# .NET

Basic question. I don't really have an issue with approaching the coding for converting PDF to .csv or excel file types, but I'm relatively new to Visual Studio and .NET development. What type of project should I create in Visual Studio to best execute this kind of task? I want a clean simple-to-use end product.
Should I make a console app? A windows app? What's the best way to package my final project and distribute it to people who aren't tech savvy (i.e. what's the best type of project to build with the simplest instructions to execute for an end user).
If it helps, my code will be searching for a specific directory to access the pdf files. This would mean that the end user would dump their pdf files in that directory. Assuming the end-user does not have Visual Studio on their PCs what is the best project type to pursue?
I think that you need VS Solution with two projects:
a class library with business logic;
a Console/Windows Forms/WPF App project.
The last depends on your client's wishes.

How do I make a MVC project appear properly in Visual Studio?

How do I make a MVC project appear properly in Visual Studio? I understand the logic of this sort of structure. I have seen some blogs and explanations and even code segments explaining how a program can use MVC. But I want to know what is a good way to represent a Model-View-Controller program in the Visual Studio.
For example, in an ASP.NET program, the asp.net file is associated with a C# file. THey have the same name and, in the Solution Explorer window of the Visual Studio development environment, they are shown linked together where one is a tree branch of the other. Should the same sort of thing be done for a MVC solution? I can remember a few years ago, I worked on a MVVM project, and a developer who first put the solution file together actually had view and the view-model files arranged like this. In order to make this happen, he had to download some sort of patch that allowed him to edit the .sln (solution) file.
Is that the way to go for a Model-View-Controller program? Should each be its own workspace in the solution, or should the solution file be edited such that each Model-View-Controller coupling be handled as a tree structure file representation kind of like it is done for an ASP.NET solution?
Here is another question. What is a good template to use in Visual Studio to create an example of a Model-View-Controller program? I tried this route but when I clicked to "get new templates", it did not work:
http://i67.photobucket.com/albums/h292/Athono/Embedded/Capture_02_zps6vn4ri07.png
http://i67.photobucket.com/albums/h292/Athono/Embedded/Capture_zpscdczk1b4.png
From your screenshots, it looks like you're using an old version of Visual Studio (either 2008 or 2010, there isn't enough showing to be sure, but I see the default .NET framework listed as 3.5 up there).
The latest versions of the ASP.NET MVC framework requires .NET 4.5. Visual Studio 2010 doesn't support this, so the solution is to upgrade to a newer version of Visual Studio which includes support and project templates specifically for the latest versions of ASP.NET MVC.

Create Solution/Project programmatically without Visual Studio

I would like to create a Visual Studio Solution and a C# Project programmatically, but without a instance of Visual Studio installed on the machine.
Scenario
I am trying to build a "engine" that will read some metadata in a SQL database and transform them into a UI. The database will be maintained by another people with a Web or WCF interface and I want the Server Application frequently (by schedule or pressing a button) use this informations to create autommaticaly a new version of the software (create solution -> project -> build -> create deployment).
So, I searched about programmatically create Solution and I found only the Automation Model in VS, it's about use an Add-In Project and this don't serves for my propose.
Perhaps I was a little confused in my explanation, so ask me more especific details, so I can be more accurate :)
Thanks for help
I think generating the solution is a little extreme.
The solution file structure hasn't changed much since 2005 http://msdn.microsoft.com/en-us/library/bb165951(v=VS.80).aspx, and there are a few projects trying to automate their generation, like Premake https://bitbucket.org/premake.
However, the kind of scenario you describe, might be I believe (better?) adressed with t4 templates http://msdn.microsoft.com/en-us/library/vstudio/bb126445.aspx, or only project file generation.
What you are describing is possible to do in C# Windows app but tedious and difficult. I remember seeing VB6.0 app like that but here i would suggest you look into WPF. Still it's C# programming but WPF can load dynamically a "window" from a string or a file if you want.

Skip DLL files in .NET setup project

everyone, I am having a question or problem when building a setup project for an add-in (both are developed in c#). The add-in is used for a big software, and it needs a DLL from the software. If I just build the add-in and use it, it is fine. But if I install it using a setup project, the DLL provided by the software should also be copied to make the add-in work. But since if the client who uses the software, has already the DLL (coming along with the software), so I wanted to skip this DLL, so exclude it from the setup. But if I do so, I will get error 1001 when installing the add-in, saying at least one type from the assembly (the add-in) cannot be loaded. If I include everything (all the dependencies), it works.
So does anyone have idea about this? How can I skip the already available DLL that comes along with the software?
you can use web deployment project to build your application instead of the default publish in visual studio and before building it right click on the WDP and select Open Project File:
inside the .wdproj file search for item group <ItemGroup></ItemGroup> tag and add the following
<ExcludeFromBuild Include=”$(SourceWebPhysicalPath)\FolderName\**\*.*” />

Creating a 'Custom Designer' Visual Studio 2010 Add-in

A major part of our work is creating and manipulating certain XML files, for which have a custom editor. The editor is starting to get creaky and we are looking at building a replacement. Since VS2010 has recently arrived, ostensibly with an improved add-in architecture (MEF?), I am interested in the possibility of building the editor as a custom editor within Visual Studio.
It would have to appear in the same way as the code editor or the Designer - a tab item, of which there can be many open at once, containing the GUI we use to edit the files. It would integrate with VS's Edit menu. It could use the output window to display messages. It would appear the same as any other editor within Visual Studio.
Right now, I am looking for examples of add-ins that work in a similar way - ideally with source code - to see whether this model would suit our requirements. I am also looking for any documentation or tutorials relevant to creating a VS2010 add-in, or information about VS2008 add-ins if this is still relevant.
Any input is welcome. Thanks!
You want to look at the Managed Extensibility Framework for VS 2010. Since 2010 is written in .net you can create add on components using it.
Code editor extension for VS 2010.
Working with MEF
Custom Editor Extensions
Update:
Since someone asked in a comment, I thought I would post this link on creating add ons for vs 2008: http://msdn.microsoft.com/en-us/vstudio/bb968855.aspx

Categories