Reg-Free COM written in 1C language - dcom

I'm writting application in C which calls functions from a DCOM object.
The DCOM is stored in DLL written in 1C language.
My application is working fine when DCOM is registred in a system.
Is there is a way to call functions from the *.dll using Reg-Free (I mean: without registration the .dll in a system)?
I've tried many times to do so but I've failed.
I used mt (from Visual Studio) to embed a manifest xml to the dll but it doesn't work .
The .dll manifest:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity type="Win32" name="DrvFR" version="1.0.0.0"/>
<file name="DrvFR.dll">
<comClass clsid="{E187099F-8C5C-4723-8866-D8DBB6353ADE}" threadingModel="Apartment"/>
</file>
</assembly>
My application manifest:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity type="Win32" name="AutomaticCommPortDetector" version="1.0.0.0"/>
<dependency>
<dependentAssembly>
<assemblyIdentity type="Win32" name="DrvFR" version="1.0.0.0"/>
</dependentAssembly>
</dependency>
</assembly>

Related

System.Net.Http.Formatting.dll in package Microsoft.AspNet.WebApi.Client 5.2.3. doesn't seem to work

I have a vb.net class library project targeting .net 4.5.1 framework. I am using Visual Studio 2013 community edition.
The project is a library consuming a webapi 2 REST API.
As a guide I am using this example.
Project's packages.config is the following:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net451" />
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net451" />
</packages>
Project's assemblies references are:
Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL
System
System.Data
System.Net.Http
System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL
<HintPath>..\..\..\..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll</HintPath>
System.Xml
System.Core
System.Xml.Linq
System.Data.DataSetExtensions
app.config file is:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
</startup>
</configuration>
The problem is that System.Net.Http.HttpClient extensions defined in Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll aren't loaded so functions like
System.Net.Http.HttpClientExtensions.PostAsJsonAsync(Of T)
and
System.Net.Http.HttpClientExtensions.PostAsXmlAsync(Of T)
aren't available.
In Object Browser System.Net.Http.HttpClientExtensions class defined in System.Net.Http.Formatting assembly under the System.Net.Http namespace are grayed out as you can see in the following screenshot:
I found several related questions like this one but the provided answers and suggestions in comments didn't work for me.
I tried several other recommendations from various internet sources, like for example replacing the reference of System.Net.Http.Formatting.dll found in Microsoft.AspNet.WebApi.Client package with the one found in the extensions assemblies area but didn't work either.
Now I am stuck and I don't know how to solve this. Any help will be highly appreciated.
EDIT
It appears that the grayed out classes in the object browser are just hidden classes (meaning they cannot be used directly in user's code) and have nothing to do with the problem described.

WCF Project - EntityFramework 5.0.0 ' 'Could not load file or assembly 'EntityFramework...' Error

I have a WCF Service application that uses EntityFramework 5.0.0 and when I called the method that uses the EDMX framework I get the below given message.
The server encountered an error processing the request. The exception message is 'Could not load file or assembly 'EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.'. See server logs for more details.
Here are my config snippets:
App.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v11.0" />
</parameters>
</defaultConnectionFactory>
</entityFramework>
</configuration>
Packages.config
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EntityFramework" version="5.0.0" targetFramework="net45" />
</packages>
Web.config
<assemblyBinding>
<dependentAssembly>
<assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
</assemblyBinding>
Am I missing anything? What do I have to check?
Help Please!!
.NET 4.5 is required. However, EF5 will run on .NET 4
So you have to check that IIS Application pool is configured to support .Net FrameWork 4.0.
For example: Sharepoint 2010 requires ASP.Net 3.5, so it does not support EF5.
Summary with the help of #Ruslan-Dayanov:
Configure and Use the Fusion Log Viewer to see where the service looks for the dll. Make sure the dll is available in that location.
References
How to configure Fusion Log: Hanselman's Guide
MSDN article on Fusion Log Viewer: Click Here

Using WiX to update manifest file

I have a manifest file for an application which looks something like this:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity name="xxx.exe" version="1.1.0.0" type="win32" processorArchitecture="x86" />
<file name="xxxxxxxx.ocx" hashalg="SHA1">
<comClass clsid="{4xxxxxxx76-D693-4156-93BA-B938A56F15D3}" description="" threadingModel="apartment" />
<typelib tlbid="{8xxxxxx-3A75-4708-993D-6E0CD9564072}" version="1.0" helpdir="" flags="control,hasdiskimage" />
</file>
<dependency>
<dependentAssembly>
<assemblyIdentity name="Assembly numero uno" version="1.1.0.0" type="win32" publicKeyToken="7XXXXXXXXXXXD" />
</dependentAssembly>
</dependency>
</assembly>
I want to add a new <dependency> section right after the </dependency> tag. The new <dependency> should look like this:
<dependency>
<dependentAssembly>
<assemblyIdentity name="Assembly number two" version="1.1.0.0" type="win32" publicKeyToken="7XXXXXXXXXXXD" />
</dependentAssembly>
</dependency>
How can I achieve this with Wix?
First of all, consider modifying the manifest at build time. If that's possible, it is much more preferable - always choose build-time complexity over install-time complexity.
It might make sense to leave this for install time only in case <dependency> element contents depends on the user input or the target system state. In this case you should use one of the WiX options to modify XML, either XmlFile #OleksandrPshenychnyy mentioned, or XmlConfig. I used the latter one more often, as it seems to be more flexible.
If you decide to go for modifying the manifest at install-time, you can still make your life a bit easier. Add the XML pattern to the manifest at build-time, and only modify the parts dependent on the user input or system state at install time. Let's say it is assemblyIdentity/version attribute. Then the WiX snippet might look like this:
<util:XmlConfig Id="VersionChange" ElementPath="assembly/dependency/dependentAssembly/assemblyIdentity[\[]#name='Assembly number two'[\]]" File="$(var.Manifest)" Name="version" Action="create" Node="value" On="install" PreserveModifiedDate="yes" Value="1.1.0.0" />
Note the square brackets escaping technique.
You can use WisUtilExtention library with XmlFile Element to perform some manipulations with XML file. For more details visit this link

Incomplete string version in DLL manifest

Every time when I'm trying to load the .dll in my application, I'm getting an error.
I don't get any errors when I'm building it.
Here is a extracted manifest from my .dll, I don't see anything problematic here, except for the string version
Is this string version normal, if not how can I fix it?
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.VC80.DebugCRT" version="8.0.50727.6195" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.VC80.DebugMFC" version="8.0.." processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
</dependentAssembly>
</dependency>
</assembly>
version="8.0.."
No, that's not normal and most certainly will cause your program to fail to start. This string comes from vc\atlmfc\include\mfcassem.h, it probably got damaged. Do not edit the file to repair the damage, copy it from another machine. That way updates will still work properly.

How to ship gdiplus.dll but not have Windows use it?

i have an application that has a dependancy on gdiplus. i need the application to also run on Windows 2000.
i want to include GDIPlus in the application directory, so that Windows 2000 computers will function, but if the machine is Windows XP, Windows Vista, Windows 7, etc, i want it to use the version of GDIPlus that ships, and is updated, with Windows.
Not possible?
From http://msdn.microsoft.com/en-us/library/ms997620.aspx Try adding the following to your manifest :-
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" processorArchitecture="x86"
name="Microsoft.Windows.mysampleapp" type="win32" />
<description>Your app description here</description>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.Windows.GdiPlus"
version="1.0.0.0" processorArchitecture="x86"
publicKeyToken="6595b64144ccf1df" language="*" />
</dependentAssembly>
</dependency>
</assembly>
Won't it be easier to do it from the installer ? IF you are installing on Windows 2000 copy Gdiplus to application directory otherwise skip it.
From the GDI+ page:
Run-time Requirements
Gdiplus.dll is included with Windows
XP. For information about which
operating systems are required to use
a particular class or method, see the
More Information section of the
documentation for the class or method.
GDI+ is available as a redistributable
for Windows NT 4.0 SP6, Windows 2000,
Windows 98, and Windows Me. To
download the latest redistributable,
see
http://www.microsoft.com/msdownload/platformsdk/sdkupdate/psdkredist.htm.
First hit on Google for "win2000 gdiplus".