Where does Visual Studio save a reference to sign certificate? - visual-studio

cannot find out where VS saves a click once sign certificate reference. The only change that happens in csproj file when one toggles between click once is this:
<SignManifests>true</SignManifests>
or
<SignManifests>true</SignManifests>
My question is, how does VS know which certificate to use when SignManifests is true?
.pom.

Actually, I found the answer myself. It's the <ManifestCertificateThumbprint> entry that references the selected certificate. If you want to view what your resolved certificate is, then you can use a build target from here.

Related

After getting asp.net project from VS team server: references don't work?

I just downloaded an asp.net project from my work's team server and it seems like a bunch of references aren't working. If I go to the references folder in the solution explorer many of them have a little yellow caution sign next to them and if I click on one them it says something like "this project cannot be viewed in the object browser ". I can't find them in the add references library either. How can I correct this?
most of them are asp.net, doNoNotOpenAuth or similar web refs
thanks
It sounds like someone added a reference to a path which doesn't exist on your system.If you right-click one of the missing references and choose Properties from the popup menu you will be able to see the path that has been set for the reference and verify if that is the case.
If your team is not already doing it, I would recommend copying third-party DLLs to a central folder under source control e.g. /lib and add all references from there to ensure that there are no path discrepancies in future.

How do I get my solution in Visual Studio back online in TFS?

I had my solution in Visual Studio 2012 (which is under TFS source control) open and the TFS server (2010) was down. When I then made a change to one of the files and attempted to save it I got a prompt to ask whether I wanted to Overwrite the file saying the TFS server was down (can't remember the exact words) and the following message appeared in the Output window:
This solution is offline. [Team Foundation Server: http://tfs1:8080/tfs/server]
The solution was offline during its previous session and will remain offline.
How do I get the file change to be recognised as being among Pending Changes and the whole solution back online?
I searched for the solution online and found this solution but wasn't too keen on the registry change.
I found a better way: right-click on the solution name right at the top of the Solution Explorer and select the Go Online option. Clicking this allowed me to select the files that had been changed when I was offline and make the solution online again.
After finding the solution, I found the following msdn forum thread which confirmed the above.
Go to File > Source Control > Go Online, select the files you changed, and finish the process.
Rename the solution's corresponding .SUO file. The SUO file contains the TFS status (online/offline), amongst a host of other goodies.
Do this only if the "right-click on the solution name right at the top of the Solution Explorer and select the Go Online option" fails (because e.g. you installed VS2015 preview).
(Additional step from solution above for if you are missing the AutoReconnect or Offline registry value)
For Visual Studio 2015, Version 14
Turn off all VS instances
HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\14.0\TeamFoundation\Instances{YourServerName}\Collections{TheCollectionName} (To get to this directory on Windows, hit the Windows + R key and search for "regedit")
Set both the Offline and AutoReconnect values to 0.
If you are missing one of those attributes (in my case I was missing AutoReconnect), right click and and create a new DWORD(32-bit) value with the desired missing name, AutoReconnect or Offline.
Again, make sure both values are set to zero.
Restart your solution
Additional info:
blog MSDN - When and how does my solution go offline?
I am using Visual Studio 2017 15.4.0 version. Especially when i started use lightweight solution option, this offline thing happened to me. I tried to above solutions which are:
Tried to regedit option but can not see appropriate menu options. Didn't work.
Right click on solution, there is go online option and
when i choose it that gives this error message: "The solution is
offline because its associated Team Foundation Server is offline.
Unable to determine the workspace for this solution."
Then from File -> Source Control -> Advanced -> Change Source Control. I saw my files. I select them and then chose bind option. That worked for me.
You can go use registry editor.
Turn off all VS instances.
Open registry editor and go to:
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\TeamFoundation\Instances
Find proper server e.g: team32system1
Go to Collection and nex DefaultCollection:
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\TeamFoundation\Instances\team32system1\Collections\DefaultCollection
Set Offline key to 0
Open solution in VS. Afterwards pop up should appear which question would you like bring solution to online mode.
Neither of the above solutions worked for me on Visual Studio Community 2017 v15.7.1. Somehow, there was no "Go Online" option in the context menu. I tried registry edit as suggested here, but that only displayed me error that it could not find the binding. What worked for me is rebinding solution to the server from Change Source Control menu.
Go to File->Source Control->Advanced->Change Source Control and make sure that your solution is binded to your source control. If not (like mine) then click on bind button, it will automatically search online TFS server and rebind your solution to it.
i found another way without much effort.
Just simply right click your solution and then click undo pending changes.
Next, VS will ask you for acutally changed file where you want to undo or not specific file.
In this you can click no for such a file where actual change is happende, rest is just undoing. This will not lost your actual changes
You will need to do two steps here for a complete solution
First click on the Solution that you have open and then go File-> Source Control -> Go Online Then uncheck all the files that are being shown as being modified while you were offline.
Don't do the Get Latest version from Source Control Explorer. That will result in a dialog potentially showing a bunch of files asking you to resolve conflicts. Instead do this
In source Control explorer right click on the folder you want to get latest of and then Advanced - Get Specific Version. In the dropdown for version type choose Latest and then choose the first check box that says Overwrite writable files that are not checked out. This will automatically bring your folder in sync with latest on the server
One method I did with mine, is to "Add to Source Control", and select 'Git'.

“Unable to find manifest signing certificate in the certificate store” - even when add new key

I cannot build projects with a strong name key signing - the message in the title always comes up.
Yes the project was initially copied over from another machine. However even if I add a new key via the Signing tab in Project Properties, this error is still shown.
I have tried running Visual Studio as an Administrator and have tried manually adding the keys to Windows Certificate Store.
Help!
Edit: I don't get this error with a new project, but I'd quite like to get this existing project working. It won't work even if I create a new certificate!
I've finally found the solution.
Edit the .csproj file for the project in question.
Delete the following lines of code:
<PropertyGroup>
<ManifestCertificateThumbprint>...........</ManifestCertificateThumbprint>
</PropertyGroup>
<PropertyGroup>
<ManifestKeyFile>xxxxxxxx.pfx</ManifestKeyFile>
</PropertyGroup>
<PropertyGroup>
<GenerateManifests>true</GenerateManifests>
</PropertyGroup>
<PropertyGroup>
<SignManifests>false</SignManifests>
</PropertyGroup>
Go to your project's "Properties" within visual studio. Then go to signing tab.
Then make sure Sign the Click Once manifests is turned off.
Updated Instructions:
Within your Solution Explorer:
right click on your project
click on properties
usually on the left-hand side, select the "Signing" tab
check off the Sign the ClickOnce manifests
Make sure you save!
It's simple!!
I resolved this problem by following this steps:
Open project properties
Click on Signing Tab
And uncheck "Sign the assembly"
That's it!!
Try this:
Right click on your project → Go to properties → Click signing which is left side of the screen → Uncheck the Sign the click once manifests → Save & Build
Open the .csproj file in Notepad.
Delete the following information related to signing certificate in the certificate store
<PropertyGroup>
<ManifestCertificateThumbprint>xxxxx xxxxxx</ManifestCertificateThumbprint>
<ManifestKeyFile>xxxxxxxx.pfx</ManifestKeyFile>
<GenerateManifests>true</GenerateManifests>
<SignManifests>false</SignManifests>
</PropertyGroup>
Go to your projects "Properties" within visual studio. Then go to signing tab.
Then make sure Sign the Click Once manifests is turned off.
OR
1.Open the .csproj file in Notepad.
2.Delete the following information related to signing certificate in the certificate store
xxxxx xxxxxx
xxxxxxxx.pfx
true
false
`
Worked for me.
Assuming this is a personal certificate created by windows on the system you copied your project from, you can use the certificate manager on the system where the project is now and import the certificate. Start the certificate manager (certmgr) and select the personal certificates then right click below the list of existing certificates and select import from the tasks. Use the browse to find the .pfx in the project (the .pfx from the previous system that you copied over with the project). It should be in the sub-directory with the same name as the project directory. I am familiar with C# and VS, so if that is not your environment maybe the .pfx will be elsewhere or maybe this suggestion does not apply. After the import you should get a status message. If you succeeded, the compile certificate error should be gone.
It is not enough to manually add keys to the Windows certificate store. The certificate only contains the signed public key. You must also import the private key that is associated with the public key in the certificate. A .pfx file contains both public and private keys in a single file. That is what you need to import.
You said you copied files from another computer. After you copied them, did you 'Unblock' them? Specifically the .snk file should be checked to make sure it is not marked as unsafe.
To sign an assembly with a strong name using attributes
Open AssemblyInfo.cs (in $(SolutionDir)\Properties)
the AssemblyKeyFileAttribute or the AssemblyKeyNameAttribute, specifying the name of the file or container that contains the key pair to use when signing the assembly with a strong name.
add the following code:
[assembly:AssemblyKeyFileAttribute("keyfile.snk")]
If you need just build the project or solution locally then removing the signing might be a dead simple solution as others suggest.
But if you have this error on your automation build server like TeamCity where you build your actual release pieces for deployment or distribution you might want to consider how you can get this cert properly installed to the cert store on the build machine, so that you get a signed packages at the end of the build.
Generally it is not recommenced to check-in/commit any PFX certificates into source control, so how you get this files on your build server during the build process is a bit another question, but sometimes people do have this file stored along with the solution code, so you can find it in the project folder.
All you need to do is just install this certificate under proper account on your build server.
Download PsExec from Windows Sysinternals.
Open a command prompt, and enter the following. It will spawn a new command prompt, running as Local System (assuming that your TeamCity is running under the default Local System account):
> psexec.exe -i -s cmd.exe
In this new command prompt, change to the directory containing the certificate and enter the filename to install (change the name of the file to yours):
> mykey.pfx
The Import Certificate wizard will start up. Click through and select all the suggested defaults.
Run the build.
All credits goes to Stuart Noble (and then further to Laurent Kempé I believe ☺).
Just ran into this (again), due to PFX cert not being included in the code, for security.
For local testing, like Debug builds, the lead programmer of this solution had me go into Properties, Signing, click on "Create Test Certificate". In our setting he said just click ok, but one can put in a strong password here if warranted/needed.

Visual Studio 2010 "Setup Project" registry editor doesn't work

I have an installation project that needs to add 1 simple string to the registry, and the built in Registry Editor in the Setup Project doesn't seem to work at all. It puts a base key HKEY_LOCAL_MACHINE\Software\[Manufacturer] by default into the install project, and that doesn't even work.
Here are the steps I used to add the key.
Right click setup project: View --> Registry
A mock Registry is displayed and I drill down creating keys as needed.
I create HKEY_LOCAL_MACHINE\Software\[Manufacturer]\[ProductName]
Run the installer. No errors are reported, but keys do NOT exist.
EDIT: Take a look at figure 5 on this webpage. It shows you kinda of what I see except in what looks like a much older version of visual studio.
I don't see how this could fail, it should be so simple. I've even tried simple keys and it just won't create anything, or at least throw an error. I've seen this solution but its ridiculous to add a post build step to manually edit the registry when there is built in functionality to do it. That post indicates that the feature is just broken, so don't use it.
If you have a 32-bit installer the keys will be redirected under HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ key
More details you can find here: http://msdn.microsoft.com/en-us/library/windows/desktop/aa384232(v=vs.85).aspx

Why am I getting "Unable to find manifest signing certificate in the certificate store" in my Excel Addin?

I've got an Excel add-in project that was created a couple years back in Visual Studio 2008. It's got some changes to be made so I've upgraded to Visual Studio 2010 (the only IDE I am able to use). Not sure if this is causing the problem but it's background information.
When I check out the code and compile it I get the error, "Error 1 Unable to find manifest signing certificate in the certificate store."
Can anyone tell me what this means and how to fix it?
You need to re-add that certificate to your machine or chose another certificate.
To choose another certificate or to recreate one, head over to the Project's properties page, click on Signing tab and either
Click on Select from store
Click on Select from file
Click on Create test certificate
Once either of these is done, you should be able to build it again.
I found this solution which solved the problem for me: Removing all entries in your *.csproj that fall into:
<manifestcertificatethumbprint>...</manifestcertificatethumbprint>
<manifestkeyfile>...</manifestkeyfile>
<generatemanifests>...</generatemanifests>
<signmanifests>...</signmanifests>
A quick solution to get me going was to uncheck the "Sign the ClickOnce manifests" in: Project -> (project name)Properties -> Signing Tab
When the project was originally created, the click-once signing certificate was added on the signing tab of the project's properties. This signs the click-once manifest when you build it. Between then and now, that certificate is no longer available. Either this wasn't the machine you originally built it on or it got cleaned up somehow. You need to re-add that certificate to your machine or chose another certificate.
Adding new certificate resolved this issue for me. Properties page -> signing -> Click on Create test certificate
Make sure you commit .pfx files to repository.
I just found *.pfx in my default .gitignore.
Comment it (by #) and commit changes. Then pull repository and rebuild.
Delete these entries mentioned in this post: http://manfredlange.blogspot.ca/2008/03/visual-studio-unable-to-find-manifest.html.
Also remove the .snk or .pfx files from the project root.
Don't forget to push these changes to GitHub, for Jenkins only pulls source from GitHub.
The issue of erroneous leftover entries in the .csproj file still occurs with VS2015update3 and can also occur if you try to change the signing certificate for a different one (even if that is one generated using the 'new' option in the certificate selection dropdown).
The advice in the accepted answer (mark as not signed, save, unload project, edit .csproj, remove the properties relating to the old certificates/thumbprints/keys & reload project, set certificate) is reliable.
I create a new key, I had to search the csproj for the old one and refactor it.

Resources