I am creating exe file of windows application using c# that creats a word application. I am targetting framework 2.0 and microsoft.interop.words ver 12. Problem is that client apllication having framework 4.0 and word 2010 installed have microsoft.interop.words ver 14.
Is ther any way I can embed above dll into exe file without using external tool or target to correct word dll version based on framework installed ??
In the settings area in you project under references you can reference the dll and set it to copy local, or you could limit you application to only use .NET 2.0
Related
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.
I am having a project in which I am using a DLL build using C# with some .NET reference having assembly version 10.0.
But, while running my application on another machine which is having VS 2012 and the assembly version 12.0, application is not able to load the DLL.
After some R & D I come to know about the version dependency of DLL.
So, Can any one tell me how do I build a DLL which can be load using available .NET version on client's machine?
Thanks in advance.
A .net assembly targets a single version of the .net framework.
You need to ensure that the target .net framework is installed on any machine on which you run the program. Either target a version of the framework that ships with your minimum supported OS version, or install the appropriate .net framework redistributable package.
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
I have two versions of a same .net project dlls.One dll with .net 2.0 and one with .net 4.0 versions.This dll is referenced inside a .net demo project.When i run the exe generated by the Demo project in a Win7 OS or lower OS then exe should use .net 2.0 based dll.When i run the application in Windows 8 then it should use .net 4.0 based dll.How can i configure this using an application manifest file.IS there any other simpler methods.
Thanks,
I'm trying develop a sample application with multi language files.
I use: Windows 7 64bit and Visual Studio 2012 Express.
I read a few tutorials on the web, and I created a sample app.
In my Debug directory I created folders for language files: 'en' and 'pl'
I created text resource files in these directories and in the main directory, so my file structure is:
lang.txt
lang.resouces
multilang.resources.dll
multilang.exe
-en
--lang.en.txt
--lang.en.resources
--multilang.resources.dll
-pl
--lang.pl.txt
--lang.pl.resources
--multilang.resources.dll
I wrote a .bat file to embed satellite assemblies do my app
resgen lang.txt
al.exe /t:lib /embed:lang.resources /culture:pl-PL /out:multilang.resources.dll
resgen en/lang.en.txt
al.exe /t:lib /embed:en/lang.en.resources,multilang.en.resources /culture:en /out:en/multilang.resources.dll
resgen pl/lang.pl.txt
al.exe /t:lib /embed:pl/lang.pl.resources,multilang.pl.resources /culture:pl /out:pl/multilang.resources.dll
In my application I use ResourceManager
_rm = new ResourceManager("multilang", Assembly.GetExecutingAssembly());
and the GetString method to obtain text
this._rm.GetString(stringFromRm);
It works fine when I compile my App in the .NET 4.5 Framework, but when I change the Target framework in Project properties to .NET 2.0 I always get this exception:
System.Resources.MissingManifestResourceException
My app must work on Windows XP, so it must work with earlier .NET Framework versions.
Could somebody tell me what I must change to run my app on .NET Framework 2.0 ?
When running resgen.exe or al.exe for an application that should run on .NET framework, you must make sure that generated assemblies can be read by .NET 2.0 runtime. Assembly format has been extended in .NET 4, so the 2.0 runtime is to able to load 4.0 assemblies.
So make sure that you're using both tools from C:\Windows\Microsoft.NET\Framework\v2.0.50727 and not from a newer framework version.