.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Using custom assembly & gacutil & sn

Posted By:      Posted Date: May 22, 2011    Points: 0   Category :

Hello experts,


I need some help please.

Yesterday I get the answer that I had to use an assembly if I would like to use a function as global. Right now I'm very desperate because my VS didn't recognize my DLL.

I get the error: "Could not load file or assembly .....The system cannot find the file specified."

After red the threads I tried to use gacutil.exe to add my assembly to the cache.

This action fails with the error:" Failure adding Assembly to cache. Attempt to install an assembly without a strong name."

View Complete Post

More Related Resource Links

trying to use custom assembly with script task in SSIS 2008 - can't find correct version of GACUtil


I am trying to use a custom assembly (compiled with VS 2005 framework 2.0) with SSIS 2008.  I understand that I need to put this Assembly in the GAC.  I initially attempted to do this using the GACUtil, but I apparently only have version 1.1 of GACUtil intalled on my development PC.  Shouldn't version 2.0 have been installed as part of VS 2005? 

So I then tried simply copying the dll into the GAC folder using windows explorer.  Well, the dll is now visibly in the GAC folder, but I cannot see it from either VS 2005 or BIDS 2008.  Does that mean I do need to use GACUtil 2.0 or higher to install the DLL into the GAC?  If so, is there any place on the Web that I can download it?

Slow load time of custom assembly on x64 compared to x86.

I am developing an application that automatically generates assemblies using the CSharpCodeProvider (.Net Framework 3.5).  These assemblies contain a single class with a very large number of local variables and methods.  After compilation I create an instance of this class (using Activator.CreateInstance) to be used elsewhere in the application.  When the application is deployed on a 32-bit system (tested on Win 7 Prof 32-bit and on Win XP) the CreateInstance method returns after 1 or 2 seconds, i.e. it first JITs the assembly before creating the instance.  However, on a 64-bit system (tested on Win 7 Home 64-bit, Win Server 2003 64-bit and Win Server 2008 64-bit) CreateInstance takes up to 5 minutes to return. Is there any reason why it would be that much slower on a 64-bit machine? I have tried many different options when compiling, such as setting the platform to x64, using the /optimize flag, etc, but none of these have made a difference. I also tried calling PrepareMethod on all the method in the class.  When I do this in the 32-bit environment, it takes approximately 10 seconds.  In the 64-bit environment it takes more than 3 minutes. As a last resort I tried ngen before constructing the object, but this made no difference in the execution time.

"Mixed mode assembly is built against version 'v2.0.50727'.... " issue and use custom config file

Hi, My Winform applilcation has used Microsoft.SqlServer.Management.Common namespace(assembly :Microsoft.Sqlserver.smo.dll/Microsoft.Sqlserver.ConnectionInfo.dll) and developed in .NET 4.0. Problem:Application is throw an exception when it tries to use above assembly reference methods. Full error text is shown below, "Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information. " Error is resolved when we include "app.config" file with below code, <?xml version="1.0"?> <configuration> <startup useLegacyV2RuntimeActivationPolicy="true"> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> </startup> </configuration> But, I need to keep configuration file as "renamed.config" and not to include app.config file as of the project requirement.I have set configuration file as "renamed.config" file using below code, //AppDomain.CurrentDomain.SetData("APP_CONFIG_FILE", "d:\\reanmed.config" ); I have also included <Startup> element in this "renamed.config" configuration file and removed the app.config file.But it raise me below error, it always expect app.config file with <Startup> element to resolve this iss

Cannot get the right permission for a Custom Assembly

Has anyone managed to deploy a custom assembly that involves calls to System.Data.SqlClient and System.Configuration (to get the connection string for the database)? I've been fighting this one for a day or two and know that the answer means finding the right mix of asserting permissions in the assembly and granting them in config files. It seems that MS have tied down the security aspects of this so as to make the facility almost unusable! I'm using Windows 7 Professional 64, SQL Server 2008 R2 (Express) and Visual Studio 2010 for development. Yet the documentation is sparse - to say the least. Does anyone know of a document that will tell me what to do?

Shell + WPF Designer + custom assembly

Hello! We try to use VS 2010 Shell to make admin workplace for our application framework. We want to use VS WPF designer to make and edit XAML markup. Markup only, not codebehind or something other. If we create xaml with controls from .NET Framework assemblies, it works right way. But we can't use our custom control libraries. Can you please tell if there is some way to make designer know about our assemblies and allow us to edit xaml-files with controls placed in those assemblies. Thankl you!

VS 2010 Isolated Shell, WPF Designer & Custom Controls produces some assembly reference errors

Hello, i currently try to use the VS 2010 isolated shell for providing a custom WPF editor.As described in the headline the WPF designer is 'partly' not able to find all assemblies (details below). After some research the only similar problem description i found here . Unfortunately I could not find any solution for my problem there. These are the steps i have successfully finished: - create a vs isolated shell application with some basic extensions (some tool windows) - create a Custom Project template based upon the MPFProj project (as describe at: here ) - Add the needed reference for custom control in project template - Create and edit XAML markup (no code behind, only markup) - Compile and run XAML Now, the following problem occurred (as a step by step description): - I add a custom control to the toolbox using the context menu "Choose Items..." (ok ) - I drag this custom control from the toolbox into the WPF designer view (ok ) - The custom control is rendered correctly and no assembly reference errors occurred (ok ) - I hit the F5 button in order to execute the XAML markup -> The application is starting correct and looks as exspected (ok ) - I close the running application (window) -> Now the WPF designer view seems to refresh and 'tells' me that an assembly (the one of the custom control) could not be found (error!!! ): There error text is: "Th

Reference Custom Assembly on Report Server

I have built the Custom Assembly and asked System Admin to deploy it on Report Server in the ReportServer/bin folder. Now System Admin has deployed this Cusomt Assembloy on Rpeort Server and sent me an URL http://mycompany/. But I am not sure how to reference this Custom Assembly using a URL in Reporting Services 2008. Please help!!!    

How to deploy custom assembly to Sharepoint and invoke it from Silverlight or WPF client?


I apologize upfront because my questions are probably trivial, but I don’t even know the correct wording to search for solution. We have C# assembly which performs some OpenXML processing and now we need to “plant” it to Sharepoint 2010 server, so that it can be invoked from the client to work on server documents.


1.     How (in what form) do we deploy it to the server, so that it is accessible (invocable) from the client code? We use VS 2010 for development.


report definition cannot find custom assembly in VS 2010



I;m trying to use custom code (C#) in a report definition and I have followed the steps outlined in MSDN to get this done. However, whenever I compile the code, I keep getting the following error

"Error while loading code module: ‘GSLibrary, Version=, Culture=neutral, PublicKeyToken=null’. Details: Could not load file or assembly 'GSLibrary, Version=, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified."

I've scoured through this forum and the net looking for answers but nothing seems to work. The closest answer was to mark the assembly as a trusted code module in the current app domain, but VS2010 complains that this method is deprecated.

The assembly works just fine elsewhere in code. How do I get custom C# code to work with the reports I am creating.

Thanks for your help.

Using a Function from a Custom assembly - An unexpected error occurred while compiling expressions.


LocalReport, SQL 2005, Custom Assembly compiled in Framework 2.0, with this I can add the reference to the report.

Client  (WinForm Framework 4.0)  In the same path of my application, I have the custom assembly (that uses the report)

When I try to get the DataSources, getParameters, or SetParameters, I always get the same error. The LoadDefinition(stream) does not load anything. Any Idea?

An unexpected error occurred while compiling expressions. Native compiler return value: ‘[BC40000] 'RequestMinimum' is obsolete: 'Assembly level declarative security is obsolete and is no longer enforced by the CLR by default. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.'.’.

I also tried to enable the NetFx40_LegacySecurityPolicy in the config of my application, and nothing change.

If I don't use the Function from the custom assembly I don't have any problem.
Thanks in advance. 

SQL Server 2005 SP3 Applied and now a MATLAB unmanaged custom assembly is being unloaded



I've inherited a SQL Server 2005 database 9.00.4035.00 SP3 Standard Edition that has a stored procedure call a Matlab assembly.  We applied SP3 to this server. 32 Bit 8 GB RAM (2.33 GHZ x 8CPU)

and now we are getting unloads due to memory pressure.. I assume that SP3 is more rigorous in regards to UNSAFE items.

The unload Message in SQL Server error logs
AppDomain 2 (BEST.dbo[runtime].1) is marked for unload due to memory pressure.

We get this type of scenario.

A. Matlab takes space creating memory pressure.
B. REDGATE SQLBackup6 Log Backups fail (due also to CLR memory issues?)
C. Matlab gets unloaded
D. We cannot recreate the assembly as there is not enough space left.
E. We need to restart the SQL Server service to have enough space to rebuld the assembly. The Buffer pool is full

I'm a bit wary to set a -g startup parameter to the sqlservr.exe since we are in a clustering environment without a real way to test it thoroughly first.   i.e my failover cluster server for SQL server is a DEV/QA sql server instance until the failover occurs. (I did not architect this by the way).

So does anyone have any suggestions in regard to getting MatLab to function again under SP3? It ran fine albeit likely obtrusively and rough under SP2.  No-one was watching for unloads for unexplained s

Cannot deploy custom MemshipProvider/RoleProvider assembly to web-site


I have written an assembly (DLL) containing two classes, MyMembershipProvider and MyRoleProvider, which are derived from MembershipProvider and RoleProvider, respectively.  I have implemented most but not all of the abstract methods; the remaining ones all throw a NotImplementedException.  I have signed the assembly and added a reference to it in my web-site project, where the relevant web.config sections look like this:

<membership defaultProvider="MyMembershipProvider">
    <add name="MyMembershipProvider" type="MyAuthentication.MyMembershipProvider"/>


<roleManager enabled="true" defaultProvider="MyRoleProvider">
    <add name="MyRoleProvider" type="MyAuthentication.MyRoleProvider"/>

When I fire up the site, however, I get the following error:

Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error detail

SSRS custom assembly failure

I've got a  DLL that (is supposed to) connect to a web service to obtain a value for presentation on my report.  The DLL method always fails when used within an SSRS report, but works fine when utilized within a windows form application running in debug mode.  I know the DLL is installed correctly because if I comment out my web service call and return a static value, it works fine.

Does anyone know why this would fail given the code and config below?  The IIS and SSRS log files do not show any error messages that could help me out.  I'm sure I'm missing a config step somewhere, but I don't know where.

I've added the web service config information to the web.config file for the ReportServer website.

DLL code:

Why creating instance of custom dll using Assembly.CreateInstance is much slower on 64 bit machine t


In my program I need to load a custom dll which I have generated through my application. When I try to create instance of this custom dll on 64 bit machine following line takes 5 times more than what it takes on 32 bit machine:

oControl = oAssembly.CreateInstance(sDLLFullPath,True)

Can anyone help me understand why this line is slow on 64 bit machine than 32 bit machine. Is there any other way to create instance of my custom dll?


Custom Controls in C# .NET

Embedding user controls in a Windows form is just like adding a simple button or text box that are already provided with .NET. These basic controls were written essentially like you code your own controls. Typically the controls you design are to be used in multiple forms or to modularize your code. These reasons help reduce the amount of code you have to type as well as make it easier for you to change your implementation. There should almost never be any reason to duplicate code because it leaves a lot of room for bugs. So, implementing functionality specific to your control in the control's source code is a good idea. This reduces code duplication as well as modularize your code, which is a good programming guideline.

Writing custom MembershipProvider

ASP.NET Membership mechanism allows to use the build-in server tables to store and retrieve user data. By default, this mechanism can only be used with SQL Server database to which Microsoft provides suitable MembershipProvider class.
Inheriting from this abstract class, developer can use his own table(-es) from any database and use any database engine other than SQL Server, like Oracle, DB2 etc.

Custom Editing Behavior for DataGridView TextBox Columns

For various reasons I'm using a DataGridView instead of a ListView, and while configuring the DataGridView to look like a ListView wasn't much of a problem, there's one thing that got on my nerves, which is the behavior of textbox cells in edit mode: It is much too easy to leave the edit mode accidentally, simply by pressing the cursor keys at the wrong time. For example when the text caret is positioned behind the last character of the textbox cell content, and you press the right arrow key
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend