VSTO Can't Read App.Config - c#

After deploying a VSTO Excel Add-In I am unable to read the app.config file.
My question is identical to this one:
VSTO Debug version fine, Installed version doesn't read app.config
Except, when I change the registry entry to use the file:/// as suggested in the post I get the following error:
The common language runtime could not be loaded by file:///C:\Program Files (x86)\company\product\addin.vsto|vstolocal. Contact your administrator for further assistance.
Without using file:/// the Add-In loads fine but doesn't read the configuration file.
I am using the following software:
Excel 2010 (installed - 32bit)
VSTO 2010 (10.0.60724 - 64bit)
Windows 7 (64-bit)
.NET (4.6.00081)
The link here says that based on my software I needed to install the 64bit of VSTO:
https://msdn.microsoft.com/en-us/library/bb608603.aspx?f=255&MSPPError=-2147217396
I tried to install .NET 4.0 and .NET 4.5 but as 4.6 is installed it won't continue. 4.6 is required by the add-in.
Is there something I am missing that is required to get this to work?

I managed to resolve this. The problem was that InstallShield does not contain a prerequisite of .NET 4.6.1 yet and so the developer had selected .NET 4.6 instead, however when the Add-In loads it looks for the exact version of .NET it requires which was not part of the installation.
To resolve, I removed .NET 4.6 and installed 4.6.1 manually.

Related

Build error after installing TXTextControl

I have installed TXTextControl .NET 15.1 with a valid license key on a brand-new Windows Server 2016, and I have installed Visual Studio Build Tools 2017 including .NET 4.6.2 and .NET 4.7.2.
When I build my C# project (targeting .NET 4.6.2), I get the following error:
(CompileLicxFiles target) ->
licenses.licx(1): error LC0004: Exception occurred creating type 'TXTextControl.ServerTextControl, TXTextControl, Version=15.1.800.500, Culture=neutral, PublicKeyToken=6b83fe9a75cfb638' System.DllNotFoundException: The TX Text Control kernel DLL file could not be found.
The error The TX Text Control kernel DLL file could not be found hinted at something missing in the GAC, which I then proceeded to check out.
Running the gacutil.exe that came with .NET 4.7.2 indicated that the necessary registrations for
txkernel.dll
txic.dll
txtools.dll
were not there.
I then went on and installed them manually, both the x86 and AMD64 versions, from their respective locations:
C:\Program Files\The Imaging Source Europe GmbH\TX Text Control 15.1.NET\BrowserBin\txkernel.dll
C:\Program Files\The Imaging Source Europe GmbH\TX Text Control 15.1.NET\BrowserBin64\txkernel.dll
etc.
But it still didn't work!
I then contacted support, but their reply was that my license was no longer valid for support, so they basically refused to answer any questions about the product.
After a while I then got the supporter to say that the company never test OLD versions of TXTextControl on NEW versions of Windows, so my best bet would be to purchase a new license.
Since the license is pretty expensive, and our (PERPETUAL!) license is perfectly valid for running the product, I am determined to find a solution to this issue.
Can anyone help me?
After some struggling, I found the solution: Install .NET 3.5 BEFORE installing TXTextControl .NET.
My hypothesis is that the TXTextControl installer fails to check the exit codes, when running gacutil.exe, so it doesn't detect that the registrations have failed.
This means that the recipe for solving this problem (which I post here for Bingle to pick up), is to:
wipe any GAC registrations you may have made in an attempt to manually install the TXTextControl DLLs
uninstall TXTextControl .NET
go to Server Manager and "Add Roles and Features", and then on the "Features" pane, you put a checkmark next to ".NET Framework 3.5 Features" (which causes a single checkmark to be in ".NET Framework 3.5 (includes .NET 2.0 and 3.0)")
reinstall TXTextControl .NET
After this was done, I could build my code!
From having similar sounding issues with the ASP.Net version, make sure that you also have Visual C++ Redistributable Packages for Visual Studio 2013 installed as since v25 this has been required and for any machines that don't already have that installed then the ASP.Net version throws similar errors about txic.dll.

Could not load file or assembly System.DirectoryServices. This assembly is built by a runtime newer than the currently loaded runtime [duplicate]

I have downloaded published (code behind files are no there, combined with dll in bin folder) web application from Window Server 2008 where it is hosted, and open it with Visual Studio when I debug that application it shows following error:
"Could not load assembly because this assembly is built by a runtime newer than the currently loaded runtime"
I don't know how can I solve this problem and test application locally.
Please help me.
This errors happens when the DotNet framework you are using is of older version than the one used to build the assembly. You need to check which version of framework is used to build those assemblies and then use the same or higher to debug too.
I was getting this same error when running an installer for a Windows service, even when running the installer on the PC the installer was built on.
It turned out that although the Windows service project had been updated to .NET 4.5, the Setup project that was making the installer was still set to use .NET 2.0.
To check if the Setup project is using an older version of .NET than the project to be installed, in the Visual Studio Solution Explorer:
Expand the Setup project;
Under the Setup project, expand Detected Dependencies;
Under Detected Dependencies select Microsoft .NET Framework and check the Version property. Select the appropriate .NET version from the dropdown list;
Re-build the Setup project to create a new version of the installer.
This error can have a lot of other reasons, too. I had the same problem, and nothing helped until I stumbled across this:
TlbExp.exe error:This assembly is built by a runtime newer
I just ran into this issue when the assembly was built with a target framework of .NET 4, and v4.0.30319 was installed on the server, and other 4.0 apps were running successfully.
The problem arose because the app had originally been built targeting 2.0, and new 4.0 assemblies were pushed, but not the app.config file, which we generally update separately.
This means the supportedRuntime attribute was not updated in the config and caused the error. Adding the following to the app.config fixed our issue:
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup>
One the the assemblies reference in the project might be built using a newer version of .net, check version of every assembly reference and correct accordingly.
Also check the application pool that this web site is running as. It could be framework 2.0 default on some older windows servers. Change it to framework 4.0.

Can Exchange 2010 Transport Agents be built and installed with .NET 4.0

I'm trying to use .NET 4.0 to build a Exchange 2010 transport agent.
But I had to compile as x64 and .NET 3.5 for the install to work (used VS2013) otherwise I get an error: "This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded." when trying to install the agent.
.NET 3.5 was required by the two references
Microsoft.Exchange.Data.Common
Microsoft.Exchange.Data.Transport
But according to this .NET 4.0 is supported on Exchange 2010
I've used this guide to build the agent
I tried to follow this article but I can't get a .NET 4.0 version of the .dll to install
Yes, it can be built in Framework .NET 4.0.
what actually matters is the correct version number of the following files:
Microsoft.Exchange.Data.Common
Microsoft.Exchange.Data.Transport
PLEASE NOTE:
Whenever you update the Exchanger Server (E.g. Service Pack, Update Rollups) ther version of these two files might chance.
So, Microsoft Exchange Transport Service does not get up again

Is Microsoft.Office.Interop.Excel in-built with .net framework 4.0

I have referenced "Microsoft.Office.Interop.Excel" library in my application to generate excel with embed interop type set to "True". Build happens fine in Dev machine which has excel installed. My doubt is whether the same application builds fine in the Build machine which does not have excel installed.
Got to know that these COM libraries are installed in GAC assembly. Does this library come by default with .net framework or comes with installation of MS-Office excel?
I'm building my application in .net framework 4.0.
Please clarify.
No, the office COM libraries are not installed by default in the GAC. They are not part of the .Net framework. Office, (or at least all the appropriate dlls) have to exist on the target machine.
Edit:
see MS OFFICE C#: Primary Interop Assemblies
To Answer your qunestions
My doubt is whether the same application builds fine in the Build
machine which does not have excel installed?
Yes it will build fine but if you have implemented any Excel related functions it will not work in your build machine. Interop Assemblies are a way to work with office application from your managed code, So without having Office installed Interop is useless.
Does this library come by default with .net framework or comes with
installation of MS-Office excel?
The PIAs(Primary Interop Assembly) are installed automatically when you install Office on the development computer

MS Word cannot add to reference

I need to make some application to work with MS Word. I read some instruction and there was told, that I need to add Reference to Microsoft.Office.Interop.Word. When I opened context menu add reference - I haven't find it there. What should I do?
MS Visual Studio 2012, Windows 7.
Maybe somebody can give me more newer instructions how to program for MS Word?
You did not install the Primary Interop Assemblies when you installed word, that is why Microsoft.Office.* is missing.
Follow these instructions on how to install the assemblies.
To install the PIAs when you install Office
Ensure that you have a version of the .NET Framework that is no older than 2.0.
Install Microsoft Office and make sure that the .NET Programmability Support feature is selected for the applications you
want to extend (this feature is included in the default installation).
To install the PIAs by using the redistributable package
Ensure that you have a version of the .NET Framework that is no older than 2.0.
Download the PIAs for Microsoft Office 2010 from the following page on the Microsoft website: Microsoft Office 2010: Primary Interop Assemblies Redistributable.
Install the PIAs by following the instructions on the download page.
Assemblies > Extensions
and select both the extensions and just click OK and you are done
You have to make sure that word is installed as well. The interop libraries are installed when word is installed. If you cannot find them in the reference, but have word installed, then you can download and find them here for 2010, or here for 2007

Categories