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

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

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

Posted By:      Posted Date: August 28, 2010    Points: 0   Category :Sql Server
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

View Complete Post

More Related Resource Links

Binding to a custom App.Config file in dotnet 4.0

Hi, I need to resolve Mixed Mode assembly issue using below text in configuration file. <?xml version="1.0"?> <configuration> <startup useLegacyV2RuntimeActivationPolicy="true"> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> </startup> </configuration> But, it seems to be work only in APP.CONFIG file. and does not work in custom configurationfile (custom.config).   I gone through the below article: http://weblogs.asp.net/israelio/archive/2005/01/10/349825.aspx still it does not work seems to be work for resolve Mixed mode assemly issue. Please let me know if any one has idea on this.   Thanks, Dhaval Soni    

Setting of sharepoint 2010 custom WCF service "web.config" file for both HTTP and HTTPS



        I have created a custom SharePoint 2010 WCF service that is deployed to 14\ISAPI\MYService folder. The issue i am facing is that this service should be accessible from all Web applications, that can be HTTPS (i.e. SSL) enabled or normal HTTP. If i am making in web.config file for web application that has HTTPS enabled, then it fails for Web applications having normal HTTP configuration. My requirement is that when this WCF service is deployed it should accessible from all web applications that can be HTTPS or HTTP both. I went through number of blogs and tried whatever option they had suggested but none of them worked for me :(. Here are some of the blog that i tried:-

Resetting properties in web deployment project based on custom build config file


I'm trying to create a general build environment for multiple projects that can take a some command line parameters and execute a build based on a custom config file.

The problem I am having is after I read in the config parameters with MSBuild.Community.Tasks XMLQuery, which works fine, I can't get aspnet_complier to see these parameters.

I keep getting "error MSB3462: Either MetabasePath or VirtualPath must be specified."

 Here is my project file:

<Project InitialTargets="PreMessage" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 
   <Target Name="PreMessage">
    <Message Text="Building..." />
 <Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tas

User validation Issue in xlsx file



I am validating user from Login.xlsx file. It was working fine by validating email and password from that file. For testing i got new file same contents of file but added some more user names.

So after that when i validating the user i am getting the following error "Data type mismatch in criteria expression".

But when i replaced the new to old one it is working fine. The contens of both files are the same. So why this kind of error happened.


Custom controls and ViewState management issue



I want to know that when we create custom controls, then is there State Management through ViewState done automatically or we have to handle it explicitely ?Since i have created Custom Controls that is behaving as if it is not maintaining its state on PostBack.

Custom Search issue with freetext


Hi All,

My Environment : MOSS 2007 (sp2) with SQL Server 2005

I have a custom search webpart which uses FullTextSqlQuery to fetch the results from Index. I have a some keywords and a free text boxt to build the search query. Poeple enter their query by selecting the keywords and enter some free text into the text box.

Issue : When any PDF document (Not tested with .Doc) is searched using custom webpart with the numbers like "2,0233.21" I do not get any results returned even though the results are returned using the SharePoint out of box full text search. But when I search the content like "2+0233+21" I get results both in Out of box and in custom search webpart.

Requirement: The Custom search should be able to find the document when numbers like "2,0233.21" are entered. It should work exactly like the out of box search.

Thanks in advance for your suggestions.



How to set WebService NameSpace in web.config file?


I am trying to put the namespace value as a key in web.config file, so that when I deploy this on production, I just have to change the namespace key in the config file only, not on all of my webservice cs files. But When I try to browse this webservice after changing this code I get compilation error.


    <add key="NameSpace" value="http://csi-dev-deep/"/>

MyWebService.cs (this code works)

[WebService(Namespace = "http://csi-dev-deep/")]

MyWebService.cs code changed to the following gives compilation error.
[WebService(Namespace = ConfigurationManager.AppSettings["NameSpace"].ToString())]

Compiler Error Message: CS0182: An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type

Your help is highly appreciated.

Thank you.

Problem when using Activator.CreateObject and reading App.Config file

Hello, this is the scenario. I have an application that load at runtime severals dll. these dll are actually "adapters" that wraps calls to web services, database and so on. The app.config of the "main" application stores in config sections all information necessary to each adapter (i.e.Web ServiceURL..) and I have created inside each adapter a class to ready those values the loading at run time the DLL has been implemented by storing all necessary types into a dictionary of generics and when I need to instanciate it I call the Activate.CreateObject and I pass the specific type (I means the name of the Adapter class) The problem is that the adapter class itself is not able to get the config value because ConfigSection has not been initialized. If I write: IInterfaceAdap adapt = new myAdapter() -> I read the config data IInterfaceAdap adapt = (IInterfaceAdap)Activator.CreateObject (type) -> now way to read the data stored in the App.Config. I think that I undertood the problem but I'm not able to find a workaround to read data store in the app.config!! I need help please!!  

Issue: Load {NUL} from flat file to "Flat File Source" faild.

Hi guys, I've met a strange issue when I was working to use SSIS to load data from flat file to database. It is a story about {NUL}. Sample Flat File: FIELD_SAMPLE|OTHERS ABC{NUL}DEFG|Any Others   I placed an Flat File Source to load these into package, and the configuration of the Connection Manager are as following: FIELD_SAMPLE: Unicode string [DT_WSTR], Length 8   Then I click the "Preview" button and I can see this data in the "Preview" window correctly (with the value "ABC{NUL}DEFG"). But when I tried to run this package, I've got an error that the "ABC{NUL}DEFG" is too long for this field. Then I changed the length to 20 and it was loaded into SSIS package. But I found the value in SSIS package is "ABC", and "{NUL}DEFG" was not there~ I have no ideal why it is ok in Preview but it is not ok when the package running~     Anyway, I hope to load the {NUL} from the flat file into target database. So that is there anybody could give me a hand?

export to Txt file - Null value issue

My query: SELECT   PRIMSPEC, MI, Case   when PrimSpec='040' then MI else null end as MI2 FROM   dbo.PROVIDER WHERE   PrimSpec in ('040','041') My results when PrimSpec in 041: 041 W NULL When the results are saved to a tab delimited file the "Null" is exported as the text "NULL".  I need these values export as null (nothing), not the word null. Any ideas?

Setting maxItemsInObjectGraph in a WCF REST config file???

Hi All, I am trying to create a new WCF Rest service. I used the online VS2010 WCF REST 4.0 template as a base. I have a service up and running and have been testing it using IE/Firefox (currently it is a read only API, so I have no need to post anything back to the service). I have an issue when the number of items being returned is too large, IE give me a "Internet Explorer cannot display the webpage" I turned on tracing and was able to confirm the issue is with the maxItemsInObjectGraph property (defaults to 65536) <Message>Maximum number of items that can be serialized or deserialized in an object graph is '65536'. Change the object graph or increase the MaxItemsInObjectGraph quota. </Message> Using the defualt WCF Web.config file I have no clue how to set this value as it doesnt seem like a standardEndpoint can have this value set, or have a custom binding or behaviour assigned to them (at least I don't know how to set them). Here is the default web.config file the template created. Does anyone know how i can update/increase the maxItemsInObjectGraph property?      <system.serviceModel>    <diagnostics>      <endToEndTracing propagateActivity="true" activityTracing="true"   &nb

AjaxContorlToolkit - issue: Could not load file or assembly

Hi everyone. Can somebody please tell me how to solve this problem with my ajax controls ?I've tried with copy the .dll's files in the project, and seems they are working fine in the visual studio with drag&drop, but when I'm trying to start the project i got this error. Thanks a lot.--------------------------------------------------- Server Error in '/' Application. Could not load file or assembly 'AjaxControlToolkit.resources.ar' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.IO.FileLoadException: Could not load file or assembly 'AjaxControlToolkit.resources.ar' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Assembly Load Trace: The following information can

Calculated measures, calculated cells, and custom rollups issue

Hi,  I'm a little bit confused according to the purpose of Calculated measures, calculated cells, and custom rollups as they lead practically to the same goal, is there any differnce between those modes from a technical point of view. And for the last one, the custom roll up the question how to perform this, I need a walkthrough that lead me to undersand the way to set a custom roll up to a given dimesion, I visited microsoft site but the inforamtion that I have is poor, so is there any other source that exposes that as a step by step example? Thank youThe complexity resides in the simplicity

How to set anonymous access to IIS 7 from web config file im using asp.net 2.0 C#

HiI have developed asp.net 2.0 website with crystal report now what my problem is whenever i go to crystal report page its by default going to login.aspx or default.aspx though i didt set any login to my asp.net page..I talk with my hosting provider they said that the asp.net impersonate is enable..I think in IIS 7 authentication if i set anonymous access enable, will it work fine?so i need to know how to enable anonymous access from my webconfig ..so please let me know how to do?

Site File Structure, Folders, Learning project, subweb, web.config

I am just learning asp.net.  I purchased an "ASP.Net 3.5 web programming in C#" book, which I like allot.  I am on chapter 3 and want to complete a shopping cart exercise from the book.  I have to create several folders and files.  The exercise has the files and under the root directory and a few folders below that.  I already have a site that I've been learning on.  Can I create a subfolder on my site and put all the files in there?  Like the subfolder is the root of the project.   Here is list of Folders and files... Code/CartItem.cs Code/Product.cs Data/Cars.mdb Images/car.jpg Cart.aspx Order.aspx Web.config ................................ On my website I want to create a subfolder to keep alll the files in, as so... ShoppingCart/Code/CartItem.cs ShoppingCart/Code/Product.cs ShoppingCart/Data/Cars.mdb ShoppingCart/Images/car.jpg ShoppingCart/Cart.aspx ShoppingCart/Order.aspx ShoppingCart/Web.config ................................ Can I have two web.cong files?, one in the subfolder?  Or do I have to use the single, web.config file in the root directory of the site?  Are there any other pitfalls or trouble I might get into setting up my file structure like this?  Anything I should be aware of? Any thoughts or advice would be appreciated. Thanks, Mike   

Overriding web.config in sharepoint webpart/using custom membership in web part

I'm developing a web part for MOSS 2007. The web part is being deployed to a web application which utilizes forms-based authentication, and role/membership providers to control users. The membership table has been edited to include addition user info (I am aware, that this isn't the best way to handle additional user, i.e. profiles etc., however, this is a requirement from another department). Since my web part needs to access this information, I was thinking of implementing a custom membership provider. So far I've followed: http://msdn.microsoft.com/en-us/library/6tc47t75.aspx and I've got my custom membership class, and a very stripped down membershipprovider-class. But how do I enable/use this membership provider in my web part? I've tried creating a simple web.config in the "WebPartCode" folder of my solution, next to my webpart code file, with connection string and membership provider tags. But I don't even really know how to build/reference/use the membership provider itself, so I don't know what else I need to do. I've built a C# class library project with the two classes (membershipprovider and custom membershipuser) and compiled it and installed it in the global assembly cache - is this correct? and how do I access them from here? Hope someone can help
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