Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

How to execute scripts when opening a Solution File

$
0
0

Briefly said: I would like to know how to execute a script when opening a Visual Studio Solution File, ideally, the script being "referenced" in that Solution File ?

Here is the long story:

We are using TFS to store "good old" Web Site Projects that cannot be upgraded to Web Application Projects. Those are hosted in IIS on the development workstations (not in WebDev or IIS Express).

Those Web Sites Projects are branched in TFS (E.x.: Release 1.1, Release 1.2, ...)

When opening a Web Site Project for the first time (ex. from the branch "Release 1.1"), a Virtual Directory is created in IIS and mapped on the physical location corresponding to the local path of the branch.

When opening later this Web Site Project from another branch (ex. from the branch "Release 1.2"), Visual Studio can

- either reuse the existing Virtual Directory with its current physical location (corresponding to the local path of the "previous" branch) - Indeed, the physical location of the Virtual Directory is not updated as it happens with Web Application Projects!

- or create a new Virtual Directory with a suffix like "_1".

In the first case, Visual Studio silently creates mapping in your workspace to fetch the source from the current branch (Release 1.2) in the local path of the previous branch (Release 1.1), as far as you did only map the TFS server root ("$\") or the TFS Team Project Root ("$\<TeamProject>") in your workspace. This is completely messing up your workspace as eventually working back on the project opened from the first branch (Release 1.1) will actually check-out files in the second branch (Release 1.2).

In the second case, the URL of the site run for debugging purpose won't be the expected one and you could experience issues if your have dependencies on that URL (ex.: in navigation scenario)

The only valid approach is therefore to delete any existing Virtual Directory before opening a Solution containing a related Web Site Projects. Visual Studio will then next re-create a Virtual Directory correctly mapped....

I could to this via a Script but I would need to run that script when opening a Visual Studio Solution File. Any idea how to proceed ?

Thx a lot in adv. for any suggestions. The simplest one will be my favorite especially the ones that do not require deployment of VS addins on all the development workstations (a solution based on scripts stored in TFS next to the Solution File would be great)


Valéry Letroye



Viewing all articles
Browse latest Browse all 4410

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>