LearnRevitAPI
Nov 9, 2024
🤷♂️ Install VS for WPF
Welcome to the 2nd Lesson of WPF course for pyRevit.
It's time to prepare your dev environment for WPF.
And it's very simple. We just need to download and install Visual Studio IDE to access the WPF Designer.
And don't confuse Visual Studio with Visual Studio Code—these are two different applications for different purposes.
VS Code vs Visual Studio?
Let me clear up some things first.
Visual Studio Code is a lightweight IDE for programming.
Visual Studio is a fully featured IDE primarily used for large-scale complex application development. And we are interested in WPF Designer feature.
So we need to download and install Visual Studio!
Download Visual Studio
First of all, download Visual Studio from here.
There are different options, make sure you download Community Edition because it's the free version.
💡Visual Studio doesn't come every year, so it's okay that we download Visual Studio 2022 verison.
Configure for WPF
Once you start the installation, you will see the following menu:
In here, you can choose the framework to download and configure necessary packages.
You are only interested in .NET Desktop Development, because it provides tools for developing WPF forms.
❌ P.S. You don't need Python Development here! It's for Django and Flask frameworks.
Once you've selected .NET Framework you can click on Install. It will need to download ~7Gb, so you can go grab a cup of your favorite tea or coffee🍵
Why Not Python?
You probably wonder why I'm not selecting python Development workload. And it's because it's made for other types of frameworks.
IronPython is not supported by Visual Studio anymore. We could install older version and make it work, but it's a very annoying process and it's not worth it. Trust me.
It's also irrelevant for us anyway. We won't write any python code in Visual Studio.
We will only use it for writing XAML code by using WPF Designer and other neat features.
More on that in a moment.
Create WPF Project
Once everything is installed, you can open and test it. In the first menu look for 'Create a new project' button.
Then you will see a menu with a lot of various templates. You need to find the right WPF template.
Firstly you can use search bar on the top to search for WPF templates, but there still will be a lot of them.
You want to scroll down and select WPF App (.NET Framework) that has XAML badge under it. That's the one!
Configure Your New Project
Lastly, we need to configure a few things.
Select Location for your Project (Anywhere you like)
Name for Project and Solution (pyRevit Forms)
Framework (4.8)
💡 Revit uses .NET Framework 4.8 until 2024. Starting with Revit 2025 it uses .NET Core 8.0. That was a big jump but it should be more efficient and provide better compatibility with other platforms in the future.
You made it!
And after all these steps you should have your WPF Dev Environment ready to create awesome looking forms for pyRevit.
This is how UI interface looks like.
What's Next?
Visual Studio might look overwhelming.
It's a really powerful IDE software. However, we just need 1% of its capabilities for designing front-end of our UI forms.
There is a neat WPF Designer that will allow you to preview UI design as you write your XAML code, along with autocomplete and other useful features.
Don't worry! I will take you on a tour, and show you everything you need to know in the next lesson.
Stay Tuned!
P.S. Want Live Webinar?
I'm thinking to make a Live Webinar for WPF Course for pyRevit, so I can teach you the basics live and answer some questions.
Let me know if you are interested so I can plan accordingly.
Reply with 'Live Webinar'
Join Newsletter
📩 You will be added to Revit API Newsletter
Join Us!
which is already read by 7400+ people!