Repository navigation
Description
Hi,it raises errors when i rebuild clrmodule.The build env and config is :
window10 Visual Studio 2015 , Release Win x86 , add "PYTHON35, UCS2" compilation symbols to both Python.Runtime and clrmodule projects
The error is:
2> clrmodule -> H:\docs\python\pythonnet-master\src\clrmodule\bin\x86\ReleaseWin\clrmodule.dll
2>H:\docs\python\pythonnet-master\packages\UnmanagedExports.1.2.6\tools\RGiesecke.DllExport.targets(42,5): error : Microsoft.Build.Utilities.ToolLocationHelper could not find ildasm.exe.
2>H:\docs\python\pythonnet-master\packages\UnmanagedExports.1.2.6\tools\RGiesecke.DllExport.targets(42,5): error : C:\Users\scy\AppData\Local\Temp\tmpF161\clrmodule.il(62) : error : syntax error at token '.field' in: .field static assembly initonly int64 'D43BE459642EEF2653B9DF1524152974360EA4C5' at I_00002C9C
The rebuild output is :
1>------ Rebuild All started: Project: Python.Runtime, Configuration: ReleaseWin x86 ------
1>H:\docs\python\pythonnet-master\src\runtime\assemblymanager.cs(206,37,206,38): warning CS0168: The variable 'e' is declared but never used
1> Python.Runtime -> H:\docs\python\pythonnet-master\src\runtime\bin\x86\ReleaseWin\Python.Runtime.dll
2>------ Rebuild All started: Project: clrmodule, Configuration: ReleaseWin x86 ------
2>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.CSharp.CurrentVersion.targets(133,9): warning MSB3884: Could not find rule set file "MinimumRecommendedRules.ruleset".
2> clrmodule -> H:\docs\python\pythonnet-master\src\clrmodule\bin\x86\ReleaseWin\clrmodule.dll
2>H:\docs\python\pythonnet-master\packages\UnmanagedExports.1.2.6\tools\RGiesecke.DllExport.targets(42,5): error : Microsoft.Build.Utilities.ToolLocationHelper could not find ildasm.exe.
2>H:\docs\python\pythonnet-master\packages\UnmanagedExports.1.2.6\tools\RGiesecke.DllExport.targets(42,5): error : C:\Users\scy\AppData\Local\Temp\tmpF161\clrmodule.il(62) : error : syntax error at token '.field' in: .field static assembly initonly int64 'D43BE459642EEF2653B9DF1524152974360EA4C5' at I_00002C9C
2>H:\docs\python\pythonnet-master\packages\UnmanagedExports.1.2.6\tools\RGiesecke.DllExport.targets(42,5): error :
3>------ Rebuild All started: Project: Python.Test, Configuration: ReleaseWin x86 ------
3>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.CSharp.CurrentVersion.targets(133,9): warning MSB3884: Could not find rule set file "MinimumRecommendedRules.ruleset".
3>H:\docs\python\pythonnet-master\src\testing\eventtest.cs(26,41,26,54): warning CS0067: The event 'EventTest.InternalEvent' is never used
3>H:\docs\python\pythonnet-master\src\testing\eventtest.cs(28,40,28,52): warning CS0067: The event 'EventTest.PrivateEvent' is never used
3>H:\docs\python\pythonnet-master\src\testing\eventtest.cs(20,47,20,65): warning CS0067: The event 'EventTest.PrivateStaticEvent' is never used
3>H:\docs\python\pythonnet-master\src\testing\eventtest.cs(18,48,18,67): warning CS0067: The event 'EventTest.InternalStaticEvent' is never used
3> Python.Test -> H:\docs\python\pythonnet-master\src\testing\bin\x86\ReleaseWin\Python.Test.dll
4>------ Rebuild All started: Project: Python.EmbeddingTest, Configuration: ReleaseWin x86 ------
4>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.CSharp.CurrentVersion.targets(133,9): warning MSB3884: Could not find rule set file "MinimumRecommendedRules.ruleset".
4> Python.EmbeddingTest -> H:\docs\python\pythonnet-master\src\embed_tests\bin\x86\ReleaseWin\Python.EmbeddingTest.dll
5>------ Rebuild All started: Project: Console, Configuration: Release x86 ------
5>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.CSharp.CurrentVersion.targets(133,9): warning MSB3884: Could not find rule set file "MinimumRecommendedRules.ruleset".
5>H:\docs\python\pythonnet-master\src\console\assemblyinfo.cs(13,35,13,64): warning CS0618: 'SecurityAction.RequestMinimum' is obsolete: 'Assembly level declarative security is obsolete and is no longer enforced by the CLR by default. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.'
5> Console -> H:\docs\python\pythonnet-master\src\console\bin\x86\Release\nPython.exe
========== Rebuild All: 4 succeeded, 1 failed, 0 skipped ==========

I don't know much about C# and visual studio.Thank you very much for helping solving this problem.
Activity
chunyisong commentedon May 27, 2016
I find the same issue #216 ,so close this .
[-]window10 Visual Studio 2015 clrmodule build error[/-][+]window10 Visual Studio 2015 clrmodule build error [Closed to watch #216][/+]den-run-ai commentedon May 27, 2016
@chunyisong you can install PyPi wheels (pip install pythonnet), any reason why you need to recompile the source code locally?
Please re-open this issue, since your error is different from #216:
error : syntax error at token '.field' in: .field static assembly initonly int64Next is did you add
PYTHON35compilation flag to bothPython.Runtimeandclrmoduleprojects? Right now you have to do this manually.[-]window10 Visual Studio 2015 clrmodule build error [Closed to watch #216][/-][+]window10 Visual Studio 2015 clrmodule build error [reopen][/+]chunyisong commentedon May 27, 2016
@denfromufa I add "PYTHON35, UCS2" compilation symbols to both Python.Runtime and clrmodule projects ,but same errors occur!
Now I am using pythonnet-2.1.0-cp35-cp35m-win32.whl from PyPi,but I want to build pythonnet myself。I don't kown much about C# and VS,so I wish someoen help solve the problem.
Thanks for help and for the pythonnet project!
I reopen the issue.
den-run-ai commentedon May 27, 2016
@chunyisong can you try to update unmanaged exports to 1.2.7?
see here:
#206
also can you try to build pythonnet from python side (not in Visual Studio), see instructions here:
python.exe setup.py bdist_wheelhttps://github.com/denfromufa/pythonnet/wiki/Troubleshooting-FAQ
den-run-ai commentedon May 27, 2016
i tried building on windows 10, vs 2015 pro update 1, python35, release x86 and I do not get your error!
So please report: exact windows build number, vs 2015 full version number and license type (community, pro, express, etc.), .NET version.
chunyisong commentedon May 27, 2016
@denfromufa
I update unmanaged exports to 1.2.7.In addition, I find 1.2.7 can work if I replace "UnmanagedExports.1.2.6" with "UnmanagedExports.1.2.7" in file clrmdule/clrmodule.csproj .Then I rebuild and get "syntax error at token '.field' " .The output is:
1>------ Rebuild All started: Project: Python.Runtime, Configuration: ReleaseWin x86 ------
1>H:\docs\python\pythonnet-master\src\runtime\assemblymanager.cs(206,37,206,38): warning CS0168: The variable 'e' is declared but never used
1> Python.Runtime -> H:\docs\python\pythonnet-master\src\runtime\bin\x86\ReleaseWin\Python.Runtime.dll
2>------ Rebuild All started: Project: clrmodule, Configuration: ReleaseWin x86 ------
2>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.CSharp.CurrentVersion.targets(133,9): warning MSB3884: Could not find rule set file "MinimumRecommendedRules.ruleset".
2> clrmodule -> H:\docs\python\pythonnet-master\src\clrmodule\bin\x86\ReleaseWin\clrmodule.dll
2>H:\docs\python\pythonnet-master\packages\UnmanagedExports.1.2.7\tools\RGiesecke.DllExport.targets(58,3): error : C:\Users\scy\AppData\Local\Temp\tmp70B8\clrmodule.il(65) : error : syntax error at token '.field' in: .field static assembly initonly int64 'D43BE459642EEF2653B9DF1524152974360EA4C5' at I_00002DE0
2>H:\docs\python\pythonnet-master\packages\UnmanagedExports.1.2.7\tools\RGiesecke.DllExport.targets(58,3): error :
3>------ Rebuild All started: Project: Python.Test, Configuration: ReleaseWin x86 ------
3>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.CSharp.CurrentVersion.targets(133,9): warning MSB3884: Could not find rule set file "MinimumRecommendedRules.ruleset".
3>H:\docs\python\pythonnet-master\src\testing\eventtest.cs(20,47,20,65): warning CS0067: The event 'EventTest.PrivateStaticEvent' is never used
3>H:\docs\python\pythonnet-master\src\testing\eventtest.cs(26,41,26,54): warning CS0067: The event 'EventTest.InternalEvent' is never used
3>H:\docs\python\pythonnet-master\src\testing\eventtest.cs(18,48,18,67): warning CS0067: The event 'EventTest.InternalStaticEvent' is never used
3>H:\docs\python\pythonnet-master\src\testing\eventtest.cs(28,40,28,52): warning CS0067: The event 'EventTest.PrivateEvent' is never used
3> Python.Test -> H:\docs\python\pythonnet-master\src\testing\bin\x86\ReleaseWin\Python.Test.dll
4>------ Rebuild All started: Project: Python.EmbeddingTest, Configuration: ReleaseWin x86 ------
4>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.CSharp.CurrentVersion.targets(133,9): warning MSB3884: Could not find rule set file "MinimumRecommendedRules.ruleset".
4> Python.EmbeddingTest -> H:\docs\python\pythonnet-master\src\embed_tests\bin\x86\ReleaseWin\Python.EmbeddingTest.dll
5>------ Rebuild All started: Project: Console, Configuration: Release x86 ------
5>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.CSharp.CurrentVersion.targets(133,9): warning MSB3884: Could not find rule set file "MinimumRecommendedRules.ruleset".
5>H:\docs\python\pythonnet-master\src\console\assemblyinfo.cs(13,35,13,64): warning CS0618: 'SecurityAction.RequestMinimum' is obsolete: 'Assembly level declarative security is obsolete and is no longer enforced by the CLR by default. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.'
5> Console -> H:\docs\python\pythonnet-master\src\console\bin\x86\Release\nPython.exe
========== Rebuild All: 4 succeeded, 1 failed, 0 skipped ==========
if I run command " python.exe setup.py bdist_wheel ",the Error is much the same:
running bdist_wheel
running build
running build_ext
Installing 'UnmanagedExports 1.2.7'.
Successfully installed 'UnmanagedExports 1.2.7'.
Using mt.exe from Visual C++ for Python
Microsoft (R) Manifest Tool version 5.2.3790.2076
Copyright (c) Microsoft Corporation 2005.
Microsoft (R) Build engine version 14.0.25123.0
All rights reserved.
assemblymanager.cs(206,37): warning CS0168: The variable 'e' is declared but never used [H:\docs\python\pythonnet-master\src\runtime\Python.Runtime.csproj]
Python.Runtime -> H:\docs\python\pythonnet-master\src\runtime\bin\x86\ReleaseWin\Python.Runtime.dll
C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.CSharp.CurrentVersion.targets(133,9): warning MSB3884: Could not find rule set file “MinimumRecommendedRules.ruleset”。 [H:\docs\python\pythonnet-master\src\testing\Python.Test.csproj]
eventtest.cs(18,48): warning CS0067: The event 'EventTest.InternalStaticEvent' is never used [H:\docs\python\pythonnet-master\src\testing\Python.Test.csproj]
eventtest.cs(28,40): warning CS0067: The event 'EventTest.PrivateEvent' is never used [H:\docs\python\pythonnet-master\src\testing\Python.Test.csproj]
eventtest.cs(20,47): warning CS0067: The event 'EventTest.PrivateStaticEvent' is never used [H:\docs\python\pythonnet-master\src\testing\Python.Test.csproj]
eventtest.cs(26,41): warning CS0067: The event 'EventTest.InternalEvent' is never used [H:\docs\python\pythonnet-master\src\testing\Python.Test.csproj]
Python.Test -> H:\docs\python\pythonnet-master\src\testing\bin\x86\ReleaseWin\Python.Test.dll
C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.CSharp.CurrentVersion.targets(133,9): warning MSB3884: 无法找到规则集文件“MinimumRecommendedRules.ruleset”。 [H:\docs\python\pythonnet-master\src\embed_tests\Python.EmbeddingTest.csproj]
Python.EmbeddingTest -> H:\docs\python\pythonnet-master\src\embed_tests\bin\x86\ReleaseWin\Python.EmbeddingTest.dll
C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.CSharp.CurrentVersion.targets(133,9): warning MSB3884: Could not find rule set file “MinimumRecommendedRules.ruleset”。 [H:\docs\python\pythonnet-master\src\console\Console.csproj]
assemblyinfo.cs(13,35): warning CS0618: 'SecurityAction.RequestMinimum' is obsolete: 'Assembly level declarative security is obsolete and is no longer enforced by the CLR by default. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.' [H:\docs\python\pythonnet-master\src\console\Console.csproj]
Console -> H:\docs\python\pythonnet-master\src\console\bin\x86\Release\nPython.exe
C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.CSharp.CurrentVersion.targets(133,9): warning MSB3884: Could not find rule set file “MinimumRecommendedRules.ruleset”。 [H:\docs\python\pythonnet-master\src\clrmodule\clrmodule.csproj]
clrmodule -> H:\docs\python\pythonnet-master\src\clrmodule\bin\x86\ReleaseWin\clrmodule.dll
H:\docs\python\pythonnet-master\packages\UnmanagedExports.1.2.7\tools\RGiesecke.DllExport.targets(58,3): error : C:\Users\scy\AppData\Local\Temp\tmp9B4A\clrmodule.il(65) : error : syntax error at token '.field' in: .field static assembly initonly int64 'D43BE459642EEF2653B9DF1524152974360EA4C5' at I_00002DE0 [H:\docs\python\pythonnet-master\src\clrmodule\clrmodule.csproj]
H:\docs\python\pythonnet-master\packages\UnmanagedExports.1.2.7\tools\RGiesecke.DllExport.targets(58,3): error : [H:\docs\python\pythonnet-master\src\clrmodule\clrmodule.csproj]
Traceback (most recent call last):
File "setup.py", line 354, in
setup_requires=setup_requires
File "c:\python35\Lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "c:\python35\Lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "c:\python35\Lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "G:\pythonEnv\carMgrPy351\lib\site-packages\wheel\bdist_wheel.py", line 179, in run
self.run_command('build')
File "c:\python35\Lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\python35\Lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "c:\python35\Lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "c:\python35\Lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\python35\Lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "c:\python35\Lib\distutils\command\build_ext.py", line 338, in run
self.build_extensions()
File "c:\python35\Lib\distutils\command\build_ext.py", line 447, in build_extensions
self._build_extensions_serial()
File "c:\python35\Lib\distutils\command\build_ext.py", line 472, in _build_extensions_serial
self.build_extension(ext)
File "setup.py", line 187, in build_extension
check_call(" ".join(cmd + ["/t:Build"]), shell=use_shell)
File "c:\python35\Lib\subprocess.py", line 584, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '"C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe" pythonnet.sln /p:Configuration=ReleaseWin /p:Platform=x86 /p:DefineConstants="PYTHON35;UCS2" /p:PythonBuildDir="H:\docs\python\pythonnet-master\build\lib.win32-3.5" /p:PythonInteropFile="interop35.cs" /verbosity:minimal /p:PythonManifest="H:\docs\python\pythonnet-master\build\lib.win32-3.5\app.manifest" /t:Build' returned non-zero exit status 1
chunyisong commentedon May 27, 2016
@denfromufa My env is:
Microsoft Windows 10 pro X64
Microsoft Visual Studio Enterprise 2015
Version 14.0.25123.00 Update 2
Microsoft .NET Framework
Version 4.6.01038
Installed Version: Enterprise
Architecture and Modeling Tools 00322-90150-00888-AA858
Microsoft Architecture and Modeling Tools
UML® and Unified Modeling Language™ are trademarks or registered trademarks of the Object Management Group, Inc. in the United States and other countries.
Visual Basic 2015 00322-90150-00888-AA858
Microsoft Visual Basic 2015
Visual C# 2015 00322-90150-00888-AA858
Microsoft Visual C# 2015
Visual C++ 2015 00322-90150-00888-AA858
Microsoft Visual C++ 2015
Windows Phone SDK 8.0 - ENU 00322-90150-00888-AA858
Windows Phone SDK 8.0 - ENU
Application Insights Tools for Visual Studio Package 5.2.60328.3
Application Insights Tools for Visual Studio
ASP.NET and Web Tools 2015.1 (Beta8) 14.1.11106.0
ASP.NET and Web Tools 2015.1 (Beta8)
ASP.NET Web Frameworks and Tools 2012.2 4.1.41102.0
For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563
ASP.NET Web Frameworks and Tools 2013 5.2.40314.0
For additional information, visit http://www.asp.net/
Common Azure Tools 1.7
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
JavaScript Project System 2.0
JavaScript Project System
Microsoft Azure Mobile Services Tools 1.4
Microsoft Azure Mobile Services Tools
NuGet Package Manager 3.4.3
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.
PreEmptive Analytics Visualizer 1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.
Python Tools for Visual Studio 2.2.40315.00
Python Tools for Visual Studio provides IntelliSense, projects, templates, Interactive windows, and other support for Python developers.
Python Tools for Visual Studio - Django Integration 2.2.40315.00
Provides templates and integration for the Django web framework.
Python Tools for Visual Studio - Profiling Support 2.2.40315.00
Profiling support for Python projects.
SQL Server Data Tools 14.0.60311.1
Microsoft SQL Server Data Tools
TypeScript 1.8.29.0
TypeScript tools for Visual Studio
Visual Studio Tools for Universal Windows Apps 14.0.25123.00
The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.
[-]window10 Visual Studio 2015 clrmodule build error [reopen][/-][+]Win10 VS2015 syntax error at token '.field' in: .field static assembly initonly int64 [reopen][/+]chunyisong commentedon May 27, 2016
in file clrmodul.il:

den-run-ai commentedon May 27, 2016
Ok, let me try with .net 4.6, did you actually change python project
settings from .NET 4.0 to 4.6?
Also I need to upgrade my VS 2015 to Update 2, not sure if enterprise
edition matters.
In the meantime, can you uninstall MSVC Compiler for Python 2.7 and try
again? Your VS 2015 already includes C compiler and mt.exe.
On Friday, May 27, 2016, chunyisong [email protected] wrote:
chunyisong commentedon May 27, 2016
@denfromufa Actually my python project target framework settings is .NET Framework 4.

I will not use higher .net version if it is possible.
4 remaining items
den-run-ai commentedon May 30, 2016
perhaps @RobertGiesecke can explain what is wrong?
yajiedesign commentedon Sep 2, 2016
i have same problem
yajiedesign commentedon Sep 2, 2016
ok,I found and fixed the problem.
RGiesecke.DllExportdoes not support non EnglishILdasmgenerated IL file.You can patch
RGiesecke.DllExportwith ilspy to fix it.Find and change "// Code" to you system language.
It is in
RGiesecke.DllExport.Parsing.Actions.DeleteExportAttributeParserAction.Execute@denfromufa
@chunyisong
den-run-ai commentedon Sep 2, 2016
@yajiedesign this is great finding, perhaps you can report this to @RobertGiesecke.
@chunyisong can you test this solution above?
den-run-ai commentedon Sep 2, 2016
@yajiedesign I updated the troubleshooting wiki with your solution:
https://github.com/denfromufa/pythonnet/wiki/Troubleshooting-FAQ
chunyisong commentedon Sep 5, 2016
@yajiedesign @denfromufa I'm sorry,I can not find which code to change! I'm new to .net, Can you tell me which file and line the code is. My ststem is Chinese
den-run-ai commentedon Sep 5, 2016
@chunyisong you need to use ILSPY to open RGiesecke.DllExport.dll installed in
pythonnet/packages/UnmanagedExportsdirectory. Edit the code and recompile it with VS.Alternatively here is a Visual Studio project/solution with Unmanaged Exports decompiled and maintained by @3F:
https://github.com/3F/DllExport
den-run-ai commentedon Sep 5, 2016
here is the line you need to edit:
https://github.com/3F/DllExport/blob/7131da1304504bff6d2117f9fd94d578d9066433/RGiesecke.DllExport/Parsing/Actions/DeleteExportAttributeParserAction.cs#L17
den-run-ai commentedon Sep 5, 2016
Alternatively you can change you system language like suggested here:
http://vb6-to-csharp.blogspot.com/2012/04/code-to-export-c-dll-to-metatrader.html?showComment=1398834618131#c6534378792185890995
chunyisong commentedon Sep 6, 2016
@denfromufa @yajiedesign I changed my win10 system language to english US,and all builds sucess,no error occurs!
In addition,I think there would be a better solution than change language!
Thanks !
den-run-ai commentedon Sep 6, 2016
@chunyisong this solution is due to a problem in third-party library (Unmanaged Exports) not in pythonnet, and opened an issue for this:
3F/DllExport#7
AlexanderHuang commentedon Mar 26, 2018
Hi @denfromufa , the "UnmanagedExports" already has 1.6 version. Is there plan to update the "UnmanagedExports" part to the new version? I am hoping the new version can fix the Chinese Win 10 version problem.
den-run-ai commentedon Mar 26, 2018
@AlexanderHuang have you tested and confirmed that the latest dllexport fixes this issue?