Skip to content

Commit 7492fe7

Browse files
authored
Merge pull request #2577 from kraigb/kraigb-feedback
Clarify clr.AddReference calls for IronPython
2 parents 9edb381 + 6fb6a6d commit 7492fe7

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

docs/python/managing-python-projects-in-visual-studio.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,21 @@ You may also need to add a [search path](search-paths.md) to the folder containi
134134

135135
When working with IronPython, you can add references to .NET assemblies to enable IntelliSense. For .NET projects in your solution, right-click the **References** node in your Python project, select **Add Reference**, select the **Projects** tab, and browse to the desired project. For DLLs that you've downloaded separately, select the **Browse** tab instead and browse to the desired DLL.
136136

137-
Because references in IronPython are not available until a call to `clr.AddReference('AssemblyName')` is made, you also need to add a `clr.AddReference` call to the assembly.
137+
Because references in IronPython are not available until a call to `clr.AddReference('<AssemblyName>')` is made, you also need to add an appropriate `clr.AddReference` call to the assembly, typically at the beginning of your code. For example, the code created by the **IronPython Windows Forms Application** project template in Visual Studio includes two calls at the top of the file:
138+
139+
```python
140+
import clr
141+
clr.AddReference('System.Drawing')
142+
clr.AddReference('System.Windows.Forms')
143+
144+
from System.Drawing import *
145+
from System.Windows.Forms import *
146+
147+
# Other code omitted
148+
```
138149

139150
### WebPI projects
140151

141152
You can add references to WebPI product entries for deployment to Microsoft Azure Cloud Services where you can install additional components via the WebPI feed. By default, the feed displayed is Python-specific and includes Django, CPython, and other core components. You can also select your own feed as shown below. When publishing to Microsoft Azure, a setup task installs all of the referenced products.
142153

143-
![WebPI References](media/projects-webPI-components.png)
154+
![WebPI References](media/projects-webPI-components.png)

0 commit comments

Comments
 (0)