Showing posts with label Visual Studio. Show all posts
Showing posts with label Visual Studio. Show all posts

Friday, July 3, 2015

Homemade certificates for the web developers

Working with the web, you will definitely end up having to generate a trusted certificate at least for your localhost. In my case, I have been working with certificates a bit more and the need of a personal CA was obviously the best solution. Moreover, I wanted to modify Fiddler's CA name to avoid having the ugly "DO_NOT_TRUST_FiddlerRoot". This post describes how I automated the certificate generation process and also mitigated the Firefox's warning about the old SHA1 hashing.

Wednesday, May 28, 2014

Renew expired pfx certificates for click once applications

If you used the click once technology back in visual studio 2005 you have saved yourself a lot of hassle deploying newer versions, especially during the UAT phase. Unfortunately, if you used a dev certificate from visual studio and now you have to do a minor update, you will discover that the certificate has expired and visual studio won't allow you to use it to create a new click once deployment. Although Microsoft has suggested a couple of ways to tackle the problem, replacing the certificate is not an option in most of the cases and the provided code doesn't work that well. Cliff Stanford has fixed the provided codebase and I have uploaded a slightly modified version in github in order to preserve it.
The main modification is that I add 105 years to the expiration date, in order to avoid redoing the process every 5 years :)
Enjoy

Friday, February 21, 2014

Relative deploy locations for visual studio 2012+

Working with team foundation server, you may end up having various publish profiles to publish various configurations. You can specify relative paths in the local folder location by adding something like the following:
$(MSBuildProjectDirectory)\..\..\..\Deploy\WebSite
Watch out that the $(MSBuildProjectDirectory) points to the folder that contains the pubxml file, so it points to \Properties\PublishProfiles folder. So, the 3 back in the path, end up in the solution folder (if there is one).

Saturday, February 1, 2014

Visual studio 2013 evaluate expression problem

While debugging in vs 2013, you may run into the issue of the quick watch not evaluating the expressions while debugging. Try enabling Managed Compatibility mode by going to
Options --> Debugging --> General --> Use Managed Compatibility Mode
Note that this happened while debugging wcf services under windows 7 and never occurred on my machine running windows 8.1, but I may have been lucky.
Hope this save you some time and also check this blog post for more weird debug issues

Wednesday, January 22, 2014

Deleting multiple small files fast on windows

If you want to delete 21Gb or small txt files from your hard disk you will notice that the GUI is slow (finding files first etc). The fastest way I have found is the following:

del /f/s/q foldername > nul
rmdir /s/q foldername

Thanks Hugo for the tip.

Tuesday, January 21, 2014

Building CEF with visual studio 2013

Building Chromium Embedded Framework project (CEF) is very easy. It just needs time. Lot's of time and disk space (~21Gb).

Wednesday, January 15, 2014

Git rebase without commiting changes

If you are working on tons of changes (like switching from bootstrap v2 to v3), you might need to rebase often in order to keep up to date with your colleagues' changes. Working with visual studio helps keeping track of the added files, but if you need to, you can git add --all to add any new files. After that, create a temporary commit:

git commit -m 'tempCommit' // Create a temp commit 
git pull --rebase origin master // Rebase to the latest master 

Fix any conflicts if needed (and do "git rebase --continue" if conflicts occur) and then soft reset the head to discard the temp commit.

git reset HEAD~1

Friday, November 9, 2012

Create self signed certificate

Visual studio comes with an exquisite tool to create a self signed certificate which you can use for Exchange/IIS/ADFS/whatever you like.
makecert -r -pe -n "CN=name.domain.com" -e 01/01/2020 -ss my -sr localMachine -sky exchange -sp "Microsoft RSA SChannel Cryptographic Provider" -sy 12
Note that this will store the certificate in your local machine certificate store but it’s marked as “private key exportable” (-pe) so you can export it from there.

 I have also created a .bat file in order to automate the localhost certificate generation. Don't forget to export the ca.localhost certificate and add it as a trusteed root certificate authority.
 

Wednesday, October 3, 2012

Building openSSL on windows

In order to build openSSL from the source code you will need to install a couple of third party free software. In this post I describe what I did on a virgin windows pc in order to build openSSL 1.0.1c.

Thursday, December 15, 2011

strcasecmp: identifier not found when porting from linux to windows

Ever tried to port from linux to windows and got the :

error C3861: 'strcasecmp': identifier not found

The easiest workaround is to add a  conditional define (visual studio add the –D _WIN32 or _WIN64 depending your OS) and define the following mappings:

#if defined(_WIN32) || defined(_WIN64)
  #define snprintf _snprintf
  #define vsnprintf _vsnprintf
  #define strcasecmp _stricmp
  #define strncasecmp _strnicmp
#endif

Another common missing identifier is the Uint which can be solved adding:

#define uint=unsigned int

Debugging native node modules loading failure on windows

If you ever need to build a module that requires another library (e.g. openssl, ict, expat etc) you may receive an “Out of memory” error when you require the file. This is unfortunately a generic error on windows but you can fire up visual studio and debug node (attaching to a process) and you can can see there the exact system error number (sys_errno) by adding a breakpoint in deps\uv\src\win\error.c when uv translates the error code (uv_translate_sys_error).

Wednesday, December 14, 2011

Node.js modules cross platform compilation using gyp

Update: I have made a pull request where you can find the updated tools discussed in this article, located here
Node.js has been using waf (node-waf) to configure and build modules up to version 0.4. From v0.6 and on, the team has moved on to gyp (Generate Your Projects) which seems to be a bit more promising when it comes to cross platform compilation. This post shows how to create a simply gyp file to build your own custom native node.js modules and provides some scripts to automate the project generation process.

Friday, December 9, 2011

Building a simple native nodejs module on windows from command line

Setting up a visual studio project to just build a simple native hello world node module is an overkill and there is a simpler way to do that by using the visual studio command prompt directly. Here you may find the required commands you have to issue, plus a vcbuild.bat file that does the whole thing at once.

Building native modules for nodeJs 0.6+ with visual studio

Since version 0.6 node js supports windows native builds which allows the windows dev to use visual studio to build both nodejs and the modules. In order to make a simple node module in visual studio you will have to link the obj file with the node.lib file that is generated when you compile the nodejs on visual studio. Here is a detailed walkthrough on how to successfully build a native node module in visual studio 2010.