Saturday 28 November 2015

Could not load file or assembly 'Telerik.Reporting, Version=9.2.15.1105, Culture=neutral, PublicKeyToken=a9d7983dfcc261be' or one of its dependencies.

I am working on Telerik Reports. The application is working fine on local system or in debugging mode, but it gives an error (Could not load file or assembly 'Telerik.Reporting, Version=9.2.15.1105, Culture=neutral, PublicKeyToken=a9d7983dfcc261be' or one of its dependencies) when I am trying to deploy the application. In order to resolve this issue we just need to copy the specified dll from "C:\Program Files (x86)\Telerik\Reporting Q3 2015\Bin". 

Follow the below steps and see how I resolved this error.

Step 1: Deploy the application on the server where you want to deploy. 

Step 2: Open server using any of the FTP tool and upload an error showing dll from location "C:\Program Files (x86)\Telerik\Reporting Q3 2015\Bin" under bin folder of the deployed application. 


PS: Every time when you will update the Telerik Reporting tool and deploying your application again then you will face the same error, because of version change. This time you need to follow the same steps and upload the latest file.

Tuesday 22 September 2015

Copy Screens In LightSwitch using XML Editor

I was working on LightSwitch application and came across with an issue to copy screen. Then I tried a way to copy the screen using XML Editor. As LightSwitch screens can be edited in XML only. Here are the steps that we can follow and copy screens easily.  

Step 1: Create a with extension Copy of your screen. (e.g you want to copy Home.lsml screen then create new screen with name HomeCopy.lsml) It does not matter which template you are using. 

Step 2: Open the Home.lsml screen in XML Editor and copy all content. 

Step 3: Use the same way to open the HomeCopy.lsml screen in XML Editor and paste all the content form Home Screen. Then find and replace Home with HomeCopy keyword. 

Step 4: Apply the same way to copy the CS file code for corresponding file. CS file can be open as it is and copy the content from Home.lsml.cs to HomeCopy.lsml.cs and replace the name of all screen methods with HomeCopy. 

Thanks........

Saturday 11 April 2015

Could not load file or assembly 'C1.Silverlight.5'

While working on the Lightswitch Using C1 component, I was facing an issue that application is running in Debug mode but it was not working in Release mode. Whenever I try to run a lightswitch application in Release mode then I was facing the below issue. 

Could not load file or assembly  'C1.Silverlight.5, VersiĆ³n 5.0.20142.419, Culture=neutral, PublicToken=2aa4ec5576d6c3ce’ or one of its dependencies. The system cannot find the file specified.


After debugging this issue and find the solution from Richa's reply. It is occurring due to the C1 dll files are not loading in release mode in lightswitch. That's why it is giving this error. To resolve this issue please follow the below step.

Open the .csproj file for the desktop client project in notepad and remove the occurrence of the below lines. 

<ExtensionReferenceType>DebugOnly</ExtensionReferenceType>

Now open project in VS and rebuild and run the application.

Wednesday 4 March 2015

Link server under Server Objects in Sql server

While working on the different applications. Some times we need to link other servers with our local server so that we can execute some queries. We can link any online server with our local sql server or one VPS to another VPS. Even with this we can link Azure Sql server to any one.
Here are the queries which will help us to link the Server. 


EXEC sp_addlinkedserver
@server='NameOfServer',  
@srvproduct='',
@provider='sqlncli',
@datasrc='Server e.g 192.168.1.1,1433',
@location='',
@provstr='',
@catalog='Database Name'

EXEC sp_addlinkedsrvlogin
@rmtsrvname=' NameOfServer ',
@useself='false',
@rmtuser='User Name',
@rmtpassword='Password'

EXEC sp_serveroption ' NameOfServer ', 'Collation Compatible', true;

The above queries will help to link the server and linked server will be showing under Server Object of your sql server.

 

For executing the queries you can use the simple query method, but if your tables having foreign key relation then you have to execute you query as given below. 

declare @sql as nvarchar(max) =  'SET IDENTITY_INSERT info ON ' +
'INSERT into info ([Id], [FirstName], [LastName], [Description], [Note]) VALUES (2, N''Harsh'', N''Gupta'', NULL, N''Test1'') ' +
'SET IDENTITY_INSERT info Off'
EXEC [ServerName].DatabaseName.dbo.sp_executesql @sql
 
We have to create a simple string of all the queries and then we have to execute with the help of sp_executesql on linked server.