Problem Loading DLLs in Visual Studio for Code Creator Projects

jimmybrown710

Client
Регистрация
20.12.2012
Сообщения
15
Благодарностей
0
Баллы
0
I ran into a problem when working on an exported Code Creator project in Visual Studio.

When trying to debug the project Visual Studio would throw an exception at runtime that it was unable to load and external DLL references added to the project. After troubleshooting for a long time I found that the Interop used in debugging was trying to copy the DLL files to C:\Program Files (x86)\ZennoLab\ZennoPoster Lite\Progs\ExternalAssemblies. On Windows 7 the Program Files directory is a protected path and the Code Creator Interop fails to copy the DLL files over and Code Creator/ZennoPoster throws a File Not Found IO Exception.

Код:
Error	4	Could not load file or assembly 'ServiceStack.Interfaces, Version=4.0.0.0, Culture=neutral, PublicKeyToken=e06fbc6124f57c43' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
ExceptionString:
System.IO.FileLoadException: Could not load file or assembly 'ServiceStack.Interfaces, Version=4.0.0.0, Culture=neutral, PublicKeyToken=e06fbc6124f57c43' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
The Fusion Log shows
Код:
 (Fully-specified)
LOG: Appbase = file:///C:/Program Files (x86)/ZennoLab/ZennoPoster Lite/Progs/
LOG: Initial PrivatePath = C:\Program Files (x86)\ZennoLab\ZennoPoster Lite\Progs\ExternalAssemblies
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Program Files (x86)/ZennoLab/ZennoPoster Lite/Progs/ServiceStack.OrmLite.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/ZennoLab/ZennoPoster Lite/Progs/ServiceStack.OrmLite/ServiceStack.OrmLite.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/ZennoLab/ZennoPoster Lite/Progs/ExternalAssemblies/ServiceStack.OrmLite.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/ZennoLab/ZennoPoster Lite/Progs/ExternalAssemblies/ServiceStack.OrmLite/ServiceStack.OrmLite.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/ZennoLab/ZennoPoster Lite/Progs/ServiceStack.OrmLite.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/ZennoLab/ZennoPoster Lite/Progs/ServiceStack.OrmLite/ServiceStack.OrmLite.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/ZennoLab/ZennoPoster Lite/Progs/ExternalAssemblies/ServiceStack.OrmLite.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/ZennoLab/ZennoPoster Lite/Progs/ExternalAssemblies/ServiceStack.OrmLite/ServiceStack.OrmLite.EXE.
Do the developers know of a fix for this issue? Can ZennoPoster be installed to a different Hard Disk? I don't remember having a destination option on installation.
 

shade

Client
Регистрация
19.11.2010
Сообщения
580
Благодарностей
346
Баллы
63
I ran into a problem when working on an exported Code Creator project in Visual Studio.

When trying to debug the project Visual Studio would throw an exception at runtime that it was unable to load and external DLL references added to the project. After troubleshooting for a long time I found that the Interop used in debugging was trying to copy the DLL files to C:\Program Files (x86)\ZennoLab\ZennoPoster Lite\Progs\ExternalAssemblies. On Windows 7 the Program Files directory is a protected path and the Code Creator Interop fails to copy the DLL files over and Code Creator/ZennoPoster throws a File Not Found IO Exception.

Код:
Error    4    Could not load file or assembly 'ServiceStack.Interfaces, Version=4.0.0.0, Culture=neutral, PublicKeyToken=e06fbc6124f57c43' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
ExceptionString:
System.IO.FileLoadException: Could not load file or assembly 'ServiceStack.Interfaces, Version=4.0.0.0, Culture=neutral, PublicKeyToken=e06fbc6124f57c43' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
The Fusion Log shows
Код:
 (Fully-specified)
LOG: Appbase = file:///C:/Program Files (x86)/ZennoLab/ZennoPoster Lite/Progs/
LOG: Initial PrivatePath = C:\Program Files (x86)\ZennoLab\ZennoPoster Lite\Progs\ExternalAssemblies
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Program Files (x86)/ZennoLab/ZennoPoster Lite/Progs/ServiceStack.OrmLite.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/ZennoLab/ZennoPoster Lite/Progs/ServiceStack.OrmLite/ServiceStack.OrmLite.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/ZennoLab/ZennoPoster Lite/Progs/ExternalAssemblies/ServiceStack.OrmLite.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/ZennoLab/ZennoPoster Lite/Progs/ExternalAssemblies/ServiceStack.OrmLite/ServiceStack.OrmLite.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/ZennoLab/ZennoPoster Lite/Progs/ServiceStack.OrmLite.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/ZennoLab/ZennoPoster Lite/Progs/ServiceStack.OrmLite/ServiceStack.OrmLite.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/ZennoLab/ZennoPoster Lite/Progs/ExternalAssemblies/ServiceStack.OrmLite.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/ZennoLab/ZennoPoster Lite/Progs/ExternalAssemblies/ServiceStack.OrmLite/ServiceStack.OrmLite.EXE.
Do the developers know of a fix for this issue? Can ZennoPoster be installed to a different Hard Disk? I don't remember having a destination option on installation.
Set the administrator privileges for the Visual Studio. And more, you can copy necessary dll's to another place and add references to the project in VS. In the export time from VS to ZP format you just add library's to packing file.
 

shade

Client
Регистрация
19.11.2010
Сообщения
580
Благодарностей
346
Баллы
63
Also you should check the project property. The current .Net Framework must be 4th version.
 

jimmybrown710

Client
Регистрация
20.12.2012
Сообщения
15
Благодарностей
0
Баллы
0
Yes, the project is set to build to version 4.0 of the .Net Framework.

Visual Studio is being started with Administrators Priviledges.

The problem occurs when Visual Studio wants to debug it used Code Creator as the debug environment and the DLL's don't get copied to the folder the C:\Program Files (x86)\ZennoLab\ZennoPoster Lite\Progs\ExternalAssemblies which is used by Code Creator.

I tried creating a post build event in Visual Studio using xcopy to move the files and the xcopy call fails.
 

darkdiver

Administrator
Команда форума
Регистрация
13.01.2009
Сообщения
2 284
Благодарностей
2 728
Баллы
113
To debug the project in the Visual Studio it launches ZennoLab.CodeRunner.exe from the ZennoPoster folder.
And ALL additional dlls should be in the ZennoPoster folder or these DLLs should be registered in GAC.
According to your error you forgot to put ServiceStack.Interfaces.dll in the ZennoPoster folder.
Post build event should help you to automate copying required dlls. If it fails, read the errors and try to execute command from command line to get the exact error.
 

jimmybrown710

Client
Регистрация
20.12.2012
Сообщения
15
Благодарностей
0
Баллы
0
The Post Build Event requires XCopy and it failed with a permissions error as c:\program files is a protected folder. Visual Studio starts up with Administrator privileges. It is most likely ZennoLab.CodeRunner.exe that copies the DLLs to the required directory but fails due to not having permission to write to the protected directory.

The ServiceStack Dlls I copied to the proper directory manually and it worked. The only problem now is the Dlls that I am developing have to be manually copied to the directory every time I run a rebuild them. An easy solution would be to install the ZennoPoster app outside of the C:\Program Files directory. I don't know if this is an option but if it is that would be an easy fix.
 

darkdiver

Administrator
Команда форума
Регистрация
13.01.2009
Сообщения
2 284
Благодарностей
2 728
Баллы
113
Please post your postbuild script here, may be something wrong with it.
 

jimmybrown710

Client
Регистрация
20.12.2012
Сообщения
15
Благодарностей
0
Баллы
0
It is a simple xcopy. I use it in a batch file run as Administrator and it works but it doesn't have sufficient permissions when run in the Post Build Event. Visual Studio is run as Administrator.

xcopy "C:\Dev\ZennoPoster Projects\DAL\bin\Debug\DAL.dll" "C:\Program Files (x86)\ZennoLab\ZennoPoster Lite\Progs\ExternalAssemblies\DAL.dll" /Y
 

darkdiver

Administrator
Команда форума
Регистрация
13.01.2009
Сообщения
2 284
Благодарностей
2 728
Баллы
113
Show the screenshot of the VisualStudio with the post build event. The whole visual studio window screen shot (with window title)
 

jimmybrown710

Client
Регистрация
20.12.2012
Сообщения
15
Благодарностей
0
Баллы
0
Updating to Visual Studio 2013 fixed the issue with using XCOPY in the Post Build Events. There must have been an issue with the VS 2010 install because I had a problem with Data Tools and the Toolbar Panel as well. All working fine in 2013.
 

darkdiver

Administrator
Команда форума
Регистрация
13.01.2009
Сообщения
2 284
Благодарностей
2 728
Баллы
113
Excellent, glad to hear.
 

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)