开发者

ASP.net compile project error

Error   102 'System.Guid' does not contain a definition for 'Parse' 

According to MSDN:

http://msdn.microsoft.com/en-us/library/system.guid.parse.aspx

This is because the parse method is in mscorlib (in mscorlib.dll), .NET 4.0

All my project settings/app pools are set to .NET 4.0. But my assemblies in web.config is as follows:

<assemblies>
    <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
    <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
    <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
    <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
    <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
    <add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
    <ad开发者_StackOverflowd assembly="System.ServiceModel.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    <add assembly="MySql.Data, Version=6.3.6.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D"/>
    <add assembly="MySql.Data.Entity, Version=6.3.6.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D"/>
    <add assembly="MySql.Web, Version=6.3.6.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D"/>
</assemblies>

If I change System.core to version 4.0.0.0 it throws a lot of errors:

Error   102 The type or namespace name 'Linq' does not exist in the namespace 'System' (are you missing an assembly reference?)

Can anyone help me fix it so I can build my website?


Guid.Parse is a .NET 4.0 method ONLY, well Silverlight also but that is not relevant here. You cannot just upgrade the one assembly, upgrade the entire site to .NET 4.0. Or you can simple try to create a new GUID from the old string representation of it, if you need to stay in 3.5.

try
{
    Guid newGUID = new Guid("CA761232-ED42-11CE-BACD-00AA0057B223");
}
catch (FormatException fe)
{
    //Handle failed Guid parsing
}
catch (OverflowException oe)
{
    //Handle failed Guid parsing
}


Try to create a new .NET 4.0 site and copy all the <assemblies> tag values in it.

Did you try to remove them all also ?


1 - System.Guid.Parse - ? Try System.Guid().Parse - you should have a red line telling bad syntax

2 - If you are 3.5 then add System.data, system.data.linq to your project - if you are 4.0 then add system.data and system.linq

I notice that you have references to System.web and System.windows.forms? In the same project? Generally it is bad practice to have a web site that uses windows.forms

lastly find out if the MySQL version requires .net 4.0 - if it does there is another problem

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜