Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by wencha · Sep 29, 2011 at 09:32 PM · buildcompileexternal-librarieswindows-form

Build argument -reference:ALIAS=DLL

My problem is the following. As I need to use System.Windows.Form namespace for Windows dialogs I first tried to use normal "Edit Reference" in MonoDevelop, search for the .dll in ...\Unity\Editor\Data\Mono\lib\2.0 and just adding it. This caused a problem because as I had algo as reference System, when I write using System.Windows.Form and then build the solution, it tells me that it didn't found 'Windows' in 'System' namespace. This is obvious because it didn't had to lookup there. So I solved it in mono by adding "/reference:WinForm=" in compiler additional arguments and in my class heading:

   extern alias WinForm.

When I needed to use a namespace from that import I write for example:

   WinForm::System.Windows.Forms.SaveFileDialog saveDialog = new WinForm::System.Windows.Forms.SaveFileDialog();
   saveDialog.FileName = Path.GetFileName(myPathVar);

My problem now is that I can't access the compiler arguments in Unity. Error: Assets/scripts/GenerateFiles.cs(1,14): error CS0430: The extern alias `WinForm' was not specified in -reference option, where do I put -reference??

I have tried:

Unity.exe -batchmode -buildWindowsPlayer "PATH.TO.EXE.exe" -reference:WinForm="C:\Program Files (x86)\Unity\Editor\Data\Mono\lib \mono\2.0\System.Windows.Forms.dll" but it ain't working =S.

Thanks in advance.

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Linearch · Mar 19, 2016 at 02:27 PM 0
Share

Hi, I'm getting similar problem here. Did you ever figure out how to do this?

2 Replies

· Add your reply
  • Sort: 
avatar image
3

Answer by b4th · Feb 16, 2017 at 03:23 PM

You can access the compiler arguments in Unity by creating an smcs.rsp file in your project. These files are defined in the following doc:

https://docs.unity3d.com/Manual/PlatformDependentCompilation.html

Add your -reference flag into this file. Note that this file will not re-import automatically - you may need to right-click-reimport a script to refresh the project changes.

I've uploaded a sample project demonstrating this feature here: https://github.com/DashW/UnityExternAlias

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image kienbb · Sep 22, 2017 at 11:52 AM 0
Share

Thank you !

avatar image luke_tran · Jan 18, 2018 at 05:27 AM 0
Share

Thank you ! You save my day.

avatar image
0

Answer by timstark · Nov 05, 2019 at 07:40 AM

Hello @b4th

I have the same error, missing an extern alias.

I've downloaded your sample, but it's not working, either in my script.

I'm using Unity 2018.4.12f1. Is this outdated?,Hello @b4th

I'm also missing an extern alias: "Assets\TestBehaviour.cs(1,14): error CS0430: The extern alias 'ClassLibrary1' was not specified in a /reference option"

I've downloaded your sample project. But it's not working in your sample, either in my project.

I'm using Unity 2018.4.12f1. Could this be outdated? I'm not finding any newer answer.

Thanks in advance

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Distribute terrain in zones 3 Answers

Cache Server doesn't work localy on Unity 5.6. 0 Answers

Custom Build Question?? 0 Answers

the main compilation does not work (for pc) 1 Answer

Unity force stop build to Android 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges