Strong name reusage with large number of projects - c#

I am working for a big integration platform using Biztalk 2010 and VS2008 SSIS packages. Each interface is stored in one team project (TFS2010). On the root of the team project each interface is created with its unique name and underneath a default basic branch plan structure has been created (with Main, Dev, Release + branches when applicable, see TFS branching guideance from ALM rangers).
The issue is that each interface needs a strong name key because we want to be SCA compliant as far as possible and signing is part of the checks.
I don't want each interface to have its own strong name key, but only one strong name key for all the interfaces.
What is the best practice to handle this kind of reusable strong name key handling ?

The best practice I've found so far is this:
Create a new key file (e.g. MyProject.snk) through the VS command line, using sn.exe -k MyProject.snk - you should create the key file in the same folder as your solution.
Right click on the first project in the solution and select 'Add existing item...'
Browse to the key file you've created - do not press add - press the little dropdown icon next to it and select add as link
The key file will now be added as a link to the project - go to the project properties and your key file will now be selectable in the Signing tab.
Copy and paste the linked key file into all the other projects (this just copies the link) and select it to be the signing key for each them in turn.
This way you have the same key associated to each project, and if you ever need to replace the key, you just have to change it in one place.
Edit: Sorry - just noticed that you're actually talking about multiple solutions - I would probably still take the same sort of approach, but have the key file under source control in a centralised location. VS should be able handle this and recognise that the key file is in your workspace at a different location.

create the key with sn tool or from vs adding it to your root directory,
then every time you make a project strong named - refer to the same key file.

Related

Outlook Addin Installation and Deployment(userwise and machinewise)

We have developed a Outlook Add In. I wish to deploy this add in in both Single User / Multi user environment
I have managed to deploy this Add In for single user environment. I am adding a Registry Entry (HKCU) for single user and the add in gets installed under "APPDATA\ROAMING\CompanyName\AddInName." I am using standard MSI for installation
But the issue I face is even if i ran the Installer, I don't see Add In appearing under Outlook, unless, I browse to the installation path (as above) and double click on VSTO file and deploy it again.
For Terminal Server / Citrix based implementation, I am trying to change the Registry to HKLM but not 100% sure how this will work.
My question is that
1. How I can have deploy this Outlook Add in only in one attempt. I don't want to install and then deploy (double click VSTO) file?
2. How I can deploy this add in for Terminal Server / Citrix based implementation?
I have gone through various blogs but they are not very clear and cause more confusion.
Would appreciate your expert suggestions
Thanks
Unfortunately I can only answer the first part of your question - You will have to create registry entries so that when Outlook is started it automatically applies your installed add in. See the link below for a detailed explanation of the registry keys that are required. https://msdn.microsoft.com/en-us/library/bb386106.aspx
In short, You need to add a registry entry for your add in that contains a FriendlyName, Description, LoadBehavior and Manifest input. Directing to the following link will tell you exactly how to do this and exactly where to put the keys. https://msdn.microsoft.com/en-us/library/cc442767.aspx#To-create-registry-keys
Best of luck and If you have any issues with that, comment below and I will help you as soon as I can.
**As an added note, I once had problems similar to the one you are having, and in my case it was due to the LoadBehavior setting. I was using the "UK Spelling" of the word instead of the US spelling. LoadBehavior must be specified exactly as I have written it here.

Prevent deleting a folder during uninstall

Is there any possible way to prevent files in a folder being removed or from over written during re installation? i have a folder where i store some templates for sending mails which user can edit.I have added the basic templates in my setup and so during re installation it removes the templates which the user might have already edited and places a new copy of the template.How can i prevent this?Should i use installer class or is there any property that i can use?Please Guide.
See:
File Versioning Rules (Windows)
Especially:
Neither File Has a Version (Windows)
You are using a tool that makes every single file a key file of it's own components. Therefore, you should already be getting this default behavior. If you set Permanent, they should not get removed. You said that the use "can" modify these files. The behavior is that if they haven't modified the files, they will get overwritten and if they have modified the files they will not.
However, IMO, a better pattern is to have an override directory that users can copy templates to and modify. You can get into undesired behaviors on upgrades resulting from the conflict of 1) My new build fixes something and 2) I can't install it because the old stuff has user data. This is especially true for things like XML files.
this can be done by selecting the file properties and setting the value of permanent to true.

How can I get an unique SourceFile reference in DXCore?

I'm developing a plugin to interchange data between Enterprise Architect and Visual Studio 2012. My plugin uses the DXCore library, and so far I was able to do everything that I needed. But now I have problem that my plugin loses the track of a file if it is renamed.
I can handle the DocumentRenamed event from DXCore, but that's not the way I want it, because it will force me to rename the XML files that I'm creating for the EA interop.
So, it all boils down to the title: how can I have a property that is like the unique identifier for a given file on a project with DXCore?
Thanks.
I do not believe there is any existing unique (and unchanging) id which you can use.
If you require such an id, I would suggest that you create one of your own and maintain a dictionary of sorts.
You would name your xml files after the unique id, rather than after the project's files.
When a file was renamed, you would alter the name associated with the uniqueid and prevent the need to rename the xml file.

Exporting and importing RSA keys

I have created an app that creates a signed XML file.
Microsoft has some straight forward examples it was not that difficult to implement but much is hidden/ encapsulated in the libraries below
System.Security.Cryptography
System.Xml,
System.Security.Cryptography.Xml
I now need to export the public key and put it (the public key) in a second application so it can verify that the signed XML document is genuine.
My second application can then enable/disable various program features based on the contents of the signed XML file.
Microsoft goes on about not exporting the contents of the key container but that is exactly what I think I need to do because in my mind I need to accomplish a couple of things.
One as mentioned above I need to export the public key and then import it into a key container that resides in the application that uses the signed XML file.
Secondly I think I need to export both private and public keys in order to back them up.
Since my application will be distributed with the public key I need to back up the public, the private key and the hashing algorithm in a safe location.
Microsoft goes on about not exporting keys to clear text but I am uneasy/and don't know how to back up the key container and I'm unsure how to look at the thing and know what I want to store is actually in there when I try to view the key container in the debugger it seems to go on forever (some sections appear to repeat recursively??)
Can anyone offer advice on how to export/import RSA keys to a key container and an approach to backing up mykeys or contaner?.
Open the Microsoft Management Console (mmc.exe), navigate to File -> Add/Remove Snap-in
This dialog will pop up
On the Available snap-ins pick "Certificates"; click Add and choose to add My user account, then click Add again and choose Computer account.
Click OK. Now you find any certificates you'll need and functions to import/export them - both private (if available and exportable), and public.

Select configfile during installation

Is it possible to add a custom buildaction which allows the user to select the wanted configfilesettings during installation?
My issue is that I have a large configfile (and logfile) which currently includes settings for developmentmachines, testenvironments, stagingenvironments and production. I would like the installer to ask me (for example through a dropdownlist) which environment I want to install for and then select the correct settings.
I have previously used TT-files to generate multiple files specified for different environment from a "master config file" with all settings defined, so this would work. The problem then is that I get multiple configfiles as output and then have to rename the correct one back to the "real configfiles name" (for exampe from web.config.prod back to web.config) and then delete all the others..
If anyone have some good pointers or resources on this I would really appriciate it!

Categories