Global code is not allowed in the pure unit
3 posts
• Page 1 of 1
Global code is not allowed in the pure unit
What does this error mean? I am using the PhpCodeDomProvider, and when I call CompileAssemblyFromSource with the code variable as "echo 'hi';", this is the error that I get.
Thanks!
Kevin
Thanks!
Kevin
- eydelber@codeplex
- Posts: 5
- Joined: January 7th, 2012, 8:57 pm
RE: Global code is not allowed in the pure unit
The CodeDom provider compiles scripts in the "pure" mode, which enforces the program to have the same high-level shape as it's usual on .NET. Only class and function declarations are allowed and exe's entrypoint is a Main method.
This comes out of the fact that people usually use CodeDom to generate something that they are going to consume. Global code is unconsumable from anything else than Phalanger.
However, generating a non-pure exe makes sense. We'll add a way how to do it via CompilerParameters.CompilerOptions. But it will surely default to pure mode, because that's what our most important CodeDom customer (ASP.NET) expects :)
Thanks!
This comes out of the fact that people usually use CodeDom to generate something that they are going to consume. Global code is unconsumable from anything else than Phalanger.
However, generating a non-pure exe makes sense. We'll add a way how to do it via CompilerParameters.CompilerOptions. But it will surely default to pure mode, because that's what our most important CodeDom customer (ASP.NET) expects :)
Thanks!
- Lada Prosek
- Posts: 47
- Joined: January 7th, 2012, 8:52 pm
RE: Global code is not allowed in the pure unit
No need to add it when it's already there :)
CompilerParameters.CompilerOptions = "/pure-" will do the trick.
CompilerParameters.CompilerOptions = "/pure-" will do the trick.
- Lada Prosek
- Posts: 47
- Joined: January 7th, 2012, 8:52 pm
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 29 guests