mono开发asp.net mvc 中的一些问题

来源:互联网 发布:淘宝助手删除宝贝 编辑:程序博客网 时间:2024/05/21 18:48

    当使用Xamarin 调试asp.net mvc 如果出现类似下面的问题

        

Could not load file or assembly 'System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
或者
CS1705: Assembly `System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' references `System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version number than imported assembly `System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

首先要安装NuGet插件
打开AddIn Manager
选择 Gallery tab并且填写 Repositories
添加这个非官方的repository地址  http://mrward.github.com/monodevelop-nuget-addin-repository/4.0/main.mrep
安装nuget pagekage 从最新添加的repository
如果不能运行或许你可以通过https://github.com/mrward/monodevelop-nuget-addin手动安装,如果你使用的是Xamarin Studio非稳定版本,你或许需要从源代码重新构建并且更新依赖从src/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.addin.xml
 <dependencies>     <addin id="Core" version="4.0">     <addin id="Ide" version="4.0">  </addin></addin></dependencies>

To:

 <dependencies>     <addin id="Core" version="4.0.9">     <addin id="Ide" version="4.0.9"></addin></addin></dependencies>
然后你可以使用命令行中xbuild,生成一个插件文件
mono mdtool.exe MonoDevelop.PackageManagement.dll
你可以选择从文件安装这个插件。
安装NuGet后你可以创建MVC3项目了
创建后你会发现引用中的一些错误 在3.0,2.10 都会出现
然后打开这个 NuGet Package Manager:
搜索这个Microsoft.AspNet.WebPages
你可能碰到
Microsoft.AspNet.WebPages无法添加的问题,这个是因为
Microsoft.AspNet.WebPages依赖与Microsoft.AspNet.Razor ,因此请先按照上述方法搜索这个类库,,如果
Microsoft.AspNet.Razor也无法添加的话,请检查务必使targets选项为mono/.net 4.5 
当在调试运行时出现类似如下的问题
System.UnauthorizedAccessException Access to the path “/Library/Frameworks/Mono.framework/Versions/3.2.6/etc/mono/registry” is denied.
这个时需要目录权限按如下方法修改
sudo mkdir /Library/Frameworks/Mono.framework/Versions/3.2.6/etc/mono/registrysudo chmod g+rwx /Library/Frameworks/Mono.framework/Versions/3.2.6/etc/mono/registry

当出现如下问题的时
System.InvalidOperationException Conflicting versions of ASP.NET Web Pages detected: specified version is “1.0.0.0”, but the version in bin is “3.0.0.0”. To continue, remove files from the application’s bin directory or remove the version specification in web.config.
请修改配置文件web.config,找到<add key=”webpages:Version” value=”1.0.0.0” />修改为<add key=”webpages:Version” value=”3.0.0.0” />
当出现Storage scopes cannot be created when _AppStart is executing. 问题是
请删除引用中的Microsoft.Web.Infrastructure.dll类库,并且在生成目录中一般时bin目录也要删除该文件。

0 0
原创粉丝点击