Difference between revisions of "VSTO"
From Blue-IT.org Wiki
(→Usng Codesigning Certificates) |
|||
Line 19: | Line 19: | ||
=== Usng Codesigning Certificates === | === Usng Codesigning Certificates === | ||
From here to there look over the boarder and use Visual Studio 2013 to develop applications in C#. E. g. for Office VSTO Addins. I was confronted with the problem, that I could not start my own developed applications. Office merely refused to open and run the AddIn. To make a (very) long story short, this article saved my life: | From here to there look over the boarder and use Visual Studio 2013 to develop applications in C#. E. g. for Office VSTO Addins. I was confronted with the problem, that I could not start my own developed applications. Office merely refused to open and run the AddIn. To make a (very) long story short, this article saved my life: | ||
+ | |||
+ | ATTENTION: this need a Windows 2008 Server with a fully configured Certificaton Authority (download it and use the 180 day evaluation license)! | ||
* http://blogs.technet.com/b/deploymentguys/archive/2013/06/14/signing-windows-8-applications-using-an-internal-pki.aspx | * http://blogs.technet.com/b/deploymentguys/archive/2013/06/14/signing-windows-8-applications-using-an-internal-pki.aspx | ||
Line 28: | Line 30: | ||
I don't comment this behaviour of Windows in this case. Certainly it is good to have a strong certificate chain in a company. But hey microsoft, in some cases one simple just want to develop and share software in trusted environments without such a huge impact ;-) I am fulfilled with the believe, that MS sometimes thinks not only big, but practical. | I don't comment this behaviour of Windows in this case. Certainly it is good to have a strong certificate chain in a company. But hey microsoft, in some cases one simple just want to develop and share software in trusted environments without such a huge impact ;-) I am fulfilled with the believe, that MS sometimes thinks not only big, but practical. | ||
+ | |||
+ | When you got your PFK then put it on a secure place. | ||
+ | |||
+ | Create the .snk file for signing your assemblies: | ||
+ | |||
+ | * http://stackoverflow.com/questions/8174229/how-to-create-a-snk-from-pfx-cer | ||
+ | |||
+ | sn -p keypair.pfx key.snk | ||
+ | |||
+ | Go to the machine where you like to publish your software. Install the certificate as a '''trusted publiher''' an mark it as non exportable! | ||
+ | |||
+ | Sign your assemblies in Visual Studio with the key.snk | ||
+ | |||
==== Signtool ==== | ==== Signtool ==== |
Revision as of 15:28, 28 October 2015
Contents
Why
So, why VSTO here in an OpenSource themed wiki?
- since 2015 .NET is opensource (really)
- C# ist open source
- you can get the Visual Studio Comunity Edition for free (really free also for commercial use, if you are not working for a > 250 men company)
- Word an Excel are running fine with wine (see #MSOffice_2010_and_Wine) - Outlook not tested yet,
In most cases Word, Excel and Powerpoint are the most often used programs in business for daily communication. It is like it is. Beeing able - now - without any restrictions, to program MS-Office legally also for commercial usage. The only "drawback" is: you HAVE TO register the application and therefore create a microsoft account to be able to work with it.
Troubleshooting
Cannot create Excel projects
- [ENG]: [http://stackoverflow.com/questions/13695526/why-cant-i-create-an-excel-vsto-workbook-project-in-visual-studio-2010/29037321#29037321 Stackoverflow|
- [GER]: Social MSDN
Most likely: You have an PERSONAL.xslb File in the XSLT start folder (see above posts).
Certificate Issues
Usng Codesigning Certificates
From here to there look over the boarder and use Visual Studio 2013 to develop applications in C#. E. g. for Office VSTO Addins. I was confronted with the problem, that I could not start my own developed applications. Office merely refused to open and run the AddIn. To make a (very) long story short, this article saved my life:
ATTENTION: this need a Windows 2008 Server with a fully configured Certificaton Authority (download it and use the 180 day evaluation license)!
- http://blogs.technet.com/b/deploymentguys/archive/2013/06/14/signing-windows-8-applications-using-an-internal-pki.aspx
- and https://wiki.cac.washington.edu/display/infra/Extracting+Certificate+and+Private+Key+Files+from+a+.pfx+File
Who is affected by the same problem can also follow this guide
- https://robindotnet.wordpress.com/2013/02/24/windows-8-and-clickonce-the-definitive-answer-2/
- https://robindotnet.wordpress.com/2013/04/14/windows-8-and-clickonce-the-definitive-answer-revisited/
I don't comment this behaviour of Windows in this case. Certainly it is good to have a strong certificate chain in a company. But hey microsoft, in some cases one simple just want to develop and share software in trusted environments without such a huge impact ;-) I am fulfilled with the believe, that MS sometimes thinks not only big, but practical.
When you got your PFK then put it on a secure place.
Create the .snk file for signing your assemblies:
sn -p keypair.pfx key.snk
Go to the machine where you like to publish your software. Install the certificate as a trusted publiher an mark it as non exportable!
Sign your assemblies in Visual Studio with the key.snk
Signtool
Thanks to this article, I could solve a lot of problems:
You basically can find the path to signtool.exe searching within the MS Visual Studio installation directory:
cd C:\Program Files (x86) dir /s /b signtool.exe
which leads to:
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Bin\signtool.exe C:\Program Files (x86)\Windows Kits\8.0\bin\x64\signtool.exe C:\Program Files (x86)\Windows Kits\8.0\bin\x86\signtool.exe C:\Program Files (x86)\Windows Kits\8.1\bin\arm\signtool.exe C:\Program Files (x86)\Windows Kits\8.1\bin\x64\signtool.exe C:\Program Files (x86)\Windows Kits\8.1\bin\x86\signtool.exe
set MySignTool="C:\Program Files (x86)\Windows Kits\8.1\bin\x86\signtool.exe" set PathToKeyFilePfx= ... set ProjectDir= ... set TargetFileName= PATH_TO_DLL
"%MySignTool" sign /f %PathToKeyFilePfx%" /p MY_PASSWORD /v "%ProjectDir%\obj\Debug\%TargetFileName%"
VS Settings
Reset VS settings
- Devenv Command Line Switches: https://msdn.microsoft.com/en-us/library/xee0c8y7.aspx
- As admin: startmenu -> VS2013 -> VS-Tools -> Developer Command Prompt VS2103 (not native!)
devenv /resetuserdata devenv /setup
- As user: Open Developer Command Prompt VS2103 (not native!)
devenv /resetuserdata devenv /setup devenv /resetsettings