In our company, we are upgrading from TFS 2010 to TFS 2012. So to test everything we have a clone of the TFS server.
To test the clone I had to switch my connection to the different servers. After hitting the “Connect” button I got a “Value cannot be null.” exception. It said that also that: “Parameter name: baseUri” was the problem. After contacting a colleague of me, he said to delete the cache of the TFS server on my computer. After doing that, the connection worked as it suppose to work.
You can find the cache in the following folder: C:\Users\<yourusername>\Local Settings\Application Data\Microsoft\Team Foundation\2.0\Cache
Asp .NET MVC 4 Release Candidate is out. One of the features that is included is called the minification and bundling feature. This was already there in the beta but in the release candidate version it has changed.
Why should we use it
How does it work
Reference the files in your page.
When you run the application and use Fiddler to view the calls to your server, you still see all the files called separately.
This is because the Bundling and Minification feature by default only work when your not in debug mode. This handy because then you could debug with all the whitespaces in your files and have the performance in the production environment.
See the difference in your production environment:
Force Bundling and Minification
You can use the BundleTable.EnableOptmizations override but the best way for a little test is to remove the debug=”true” attribute in your web.config.
Today I migrated an old project from Visual Studio 2008 to Visual Studio 2010 and with that, I changed the Framework to version 4.0. This is currently the newest .NET Framework. The solution contains a lot of different projects so the challenge was to convert all the target frameworks to the 4.0 version.
There are a couple ways to this:
- Change every project by hand. (Open the properties of every project and select the target framework that you want);
- Edit the project files by hand in notepad;
- Use the macro of Scott Dorman.
The macro of Scott can be found here. Just place the macro on the right place on your pc and execute it. After you executed the macro a popup is shown with the question to which target framework you want to migrate. Choose your framework and press OK.
That’s it!!! Safes a lot of time!!
You can execute a Macro in the Tools->Macros->Macros Explorer window.
Last weekend I was working on a MVC 2 application. When I started the application my default browser (Google Chrome) came up. I actually wanted to change my browser for this application to Internet Explorer because the connectivity between IE and Visual Studio 2010 is much better than with Chrome.
The problem is that you can’t choose for the option “Browse With” in a MVC Application. This is because the controller is deciding which view should start. To fix this problem, I found an add-in for VS2010 that you can switch your default browser on the fly from your toolbar. In that way, you can switch easier between your installed browsers. See the screenshot below.
You can download the add-in by following the link below.
If you get a popup on the startup of your Visual Studio Instance with the text: “The bits have expired, please download an updated version from http://www.wovs.com”, you have to download the new version. To do this, follow the steps on this website: http://blog.wovs.com/2010/10/how-to-update-currently-expired.html
Search in the online extension manager for “Default browser switcher”.
If you want to have a master detail view of you data in Silverlight with RIA Services you have to do two things. One thing is to tell your RIA Services meta data file that you’re including the related entities and you will have to tell your domain service as well that your including the related entities. Follow the tutorial beneath to accomplish an example for creating a master detail relation with Silverlight RIA Services.
Create a new Silverlight 4 application in VS2010 and enable RIA Services. Also don’t forget to check the box to host your Silverlight application in a website.
Create your Entity Framework 4.0 model so we can generate some RIA Service over it. Just use a simple example so we can practice the master detail relationships. The example that I use is shown below.
After your model is created we have to create the Domain Service that exposes your model from the server to the client. If you haven’t used RIA Services before, I suggested you should read the documentation on the http://www.silverlight.net homepage.
Select add new item on your server website. The same place as you created your Entity Framework model. Now search for the Domain Service template. After you clicked the OK button, you will get a popup that is asking you to specify which entity the domain service should expose from your Entity Framework model. Click the Brands and Product collections, select the checkbox to generate meta data files and to enable client access.
Creating the UI
Open your MainPage.xaml file that is generated by creating the Silverlight Application. Open your Data Sources window in VS2010 and drag the Brands and Products grids to your MainPage. You have to drag your Products from the inner collection of Brands.
Now if you run your code. Only the brands will be shown because the UI is connected to the GetBrandsQuery. Now we want to include the products to create a Master Detail relation.
Configure the Meta data
Open your meta data file that is generated by the Domain Service. Find your Brands Entity and in that entity the inner collection property of Products. Add the [Include] attribute above the inner collection of products. In that way we tell RIA Services to include the products for the brand if the products are available.
Make the products available
To make the products available for RIA Services you should include them in the correct query that is used in the client. In our case it is the GetBrands in the Domain Service class.
Add the include statement like below to the query.
Now you are ready to run your code and see a nice example of a master detail relationship in the client.
It is better to create a new query then change the default query. In that way the performance is better because you don’t need the products every time you use the GetBrands query. You can create a query like GetBrandsWithProducts. If you do this, don’t forget to change the query name in the client. This is still referenced to the GetBrands query!!!
- Go to the right folder on your local machine.
- x64: C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplates\CSharp\Code\1033
- x86: C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplates\CSharp\Code\1033
- In that folder you will see the Class.zip file. If you open the class file directly from the zip, you can see the default class template of Visual Studio 2010. In my case, I want to add some default stuff like regions and constructors.
- Save the class file. It could be that you get a question that the zip file has changed and want to be reloaded. Click in that case “Yes”.
- Now, if you open VS2010, you won’t get the new class template yet. This is because the class template is not yet available in VS2010. VS2010 uses an ItemTemplatesCache directory to store the active templates. You need to override the already active template. This sounds very difficult but is very easy to do. Open your Visual Studio command prompt from the visual studio installation folder in your start menu.
(You maybe need to open it as Administrator)
Fill in this comamnd: “devenv.exe /installvstemplates”
The strange part here is that you won’t get any confirmation about the success of the installation. This could take a while because when I looked several times in visual studio, I still got the old template. After a few minuts, the new template was suddenly there.
- It is better to close all your Visual Studio instances. before you follow these steps above.
$if$ ($targetframeworkversion$ >= 3.5)using System.Linq;
public class $safeitemrootname$
#region Private Fields
#region Private Properties
#region Public Properties
/// The default Constructor
#region Private Methods
#region Public Methods
If you create an application, you have also create an installer project. The installer creates two files for you. An setup.exe file and a msi file. The icons of the two files are set by the default windows icons. In Windows 7 it looks like this:
If you want to change the icon of the installer, you can not do that by default in your installer project. Also, the icon of the msi file can not be changed at all. For the setup.exe file you have to do it manually for each time you create a new installer. So every time you fix a bug and releases a new version of your application by the new created installer you have to set the icon manually. Lucky that this is not hard to do.
Change the icon
- Create an installer project with the right settings that you want and build it.
- Now open the setup.exe file in the release folder (that is the one that you want to give to your client) in Visual Studio. You can do this as follow:
- Right click with your mouse on the icon folder and choose “Add Resource…”
- The icon type is now selected by default. Choose on the right of the popup for “Import”
- Navigate to the right icon that you want and select it
- The popup will now close and the icon folder in the explorer is expanded
- Make sure that your new icon has the lowest ID. If you don’t do that, the icon will not been shown
- Save the setup.exe and return in Windows Explorer to the release folder. You should now see the new icon.