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

Thursday, January 3, 2013

Visual Studio Could not load file or assembly bug

Message

Could not load file or assembly ... or one of its dependencies.

Context

Opening a form in Design Mode in Visual Studio 2010

Explanation

The Copy Local property of a referenced DLL appears to be true, but actually it is not set to True in the XML project file.

Looking inside the XML file:

<Reference Include="...">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\C1.Win.C1FlexGrid.4.dll</HintPath>
<Private>True</Private>
</Reference>

We should see a code like this one, but the yellow line "<Private>True</Private>", that is the one corresponding to the Copy Local property value, is missing.

Solution

The line could be manually inserted, but better proceed this way:
  1. Right click on the DLL that is giving the problem.
  2. Set the Copy Local property to False.
  3. Save the projetct
  4. Set the Copy Local property back to True.
  5. Save the project again.
This will cause Visual Studio to add the missing line "<Private>True</Private>".

Monday, February 13, 2012

The Operation Could not be Completed

Message
Starting the debugger process (debugging) in Visual Studio after changing some settings (i.e. in the app.config file) it comes out a popup with the following message: The Operation Could not be completed. 

Context
Debugging on Visual Studio 2008 or Visual Studio 2010

Explanation
Visual Studio doesn't delete the vshost.exe files in the application folder after launching debug. It looks like a Visual Studio bug. The vshost.exe files needs to be manually killed after debugging, or we need to close and reload the project.

Solution
Go to the Property window of your project, open the de "Debug" tab, look for the "Enable the Visual Studio hosting process" option and uncheck/disable that option.

Friday, February 10, 2012

Enabling IntelliSense for Client Object Model script in Visual Studio

Message
A simple way to enable/activate IntelliSense in Visual Studio while writing ECMA script. It allows, for example,  to write your javascript or jQuery code for SharePoint saving you a lot of time.
Some references: http://msdn.microsoft.com/en-us/library/ff798328.aspx

Context
Visual Studio 2010, SharePoint 2010, Visual WebPart

Explanation
Following is the list of debug .js files present in _layouts folder and depending upon the objects you are working with, you may need to add a reference to any of them to get IntelliSense.
  • SP.debug.js (to get IntelliSense on list objects)
  • SP.Core.debug.js
  • SP.Ribbon.debug.js
  • SP.Runtime.debug.js
  • JsGrid.debug.js
  • JsGrid.Gantt.debug.js


Solution
Add following lines at the start of the .ascx file in a visual webpart.

<script type="text/javascript" src="/_layouts/MicrosoftAjax.js"></script>
<script type="text/javascript" src="/_layouts/SP.Debug.js"></script>
<script type="text/javascript" src="/_layouts/SP.Core.debug.js">

PS: Exclude these references while deploying the code to production environment.