asp.net-mvc – Azure git部署 – 第二个程序集中缺少引用
我试图将Bitbucket部署到Azure网站.我成功地将Bitbucket和Azure链接起来,但是当我推到Bitbucket时,我在Azure站点上收到以下错误:
如果我点击“查看日志”,它会显示以下编译错误: D:WindowsMicrosoft.NETFrameworkv4.0.30319Microsoft.Common.targets(1578,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "System.Web.Mvc,Version=4.0.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35,processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code,you may get compilation errors. [C:DWASFilesSites&;projname>VirtualDirectory0siterepository&;projname>.Common&;projname>.Common.csproj] D:WindowsMicrosoft.NETFrameworkv4.0.30319Microsoft.Common.targets(1578,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "WebMatrix.WebData,Version=2.0.0.0,you may get compilation errors. [C:DWASFilesSites&;projname>VirtualDirectory0siterepository&;projname>.Common&;projname>.Common.csproj] CustomMembershipProvider.cs(5,7): error CS0246: The type or namespace name 'WebMatrix' could not be found (are you missing a using directive or an assembly reference?) [C:DWASFilesSites&;projname>VirtualDirectory0siterepository&;projname>.Common&;projname>.Common.csproj] CustomMembershipProvider.cs(9,38): error CS0246: The type or namespace name 'ExtendedMembershipProvider' could not be found (are you missing a using directive or an assembly reference?) [C:DWASFilesSites&;projname>VirtualDirectory0siterepository&;projname>.Common&;projname>.Common.csproj] ModelsAccountModels.cs(3,18): error CS0234: The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?) [C:DWASFilesSites&;projname>VirtualDirectory0siterepository&;projname>.Common&;projname>.Common.csproj] CustomMembershipProvider.cs(198,37): error CS0246: The type or namespace name 'OAuthAccountData' could not be found (are you missing a using directive or an assembly reference?) [C:DWASFilesSites&;projname>VirtualDirectory0siterepository&;projname>.Common&;projname>.Common.csproj] ModelsAccountModels.cs(40,10): error CS0246: The type or namespace name 'Compare' could not be found (are you missing a using directive or an assembly reference?) [C:DWASFilesSites&;projname>VirtualDirectory0siterepository&;projname>.Common&;projname>.Common.csproj] ModelsAccountModels.cs(40,10): error CS0246: The type or namespace name 'CompareAttribute' could not be found (are you missing a using directive or an assembly reference?) [C:DWASFilesSites&;projname>VirtualDirectory0siterepository&;projname>.Common&;projname>.Common.csproj] ModelsAccountModels.cs(73,10): error CS0246: The type or namespace name 'Compare' could not be found (are you missing a using directive or an assembly reference?) [C:DWASFilesSites&;projname>VirtualDirectory0siterepository&;projname>.Common&;projname>.Common.csproj] ModelsAccountModels.cs(73,10): error CS0246: The type or namespace name 'CompareAttribute' could not be found (are you missing a using directive or an assembly reference?) [C:DWASFilesSites&;projname>VirtualDirectory0siterepository&;projname>.Common&;projname>.Common.csproj] 请注意,这些编译错误与我的项目中的另一个程序集(我放置业务逻辑的程序集)相反. 当Google搜索时,我发现唯一提到的是将这些引用的“本地副本”标志设置为true.我已经尝试过,但仍然有相同的错误. 这全部在本地编译.有任何想法吗? 更新 要添加更多信息,我的项目结构在Git回购如下: +ProjName ProjName.csproj web.config ...etc... +ProjName.Common ProjName.Common.csproj +ProjName.Tests ProjName.Tests.csproj +packages <-- these are Nuget packages ProjName.sln Azure所示的编译错误表示ProjName.vcproj失败了 – 但是它们引用了ProjName.Common程序集引用. 请注意,此布局是VisualStudio创建的(即,webroot的额外项目子目录). 我不太确定Azure在做Git部署时做什么.它是否识别ProjName目录是webroot,还解析ProjName.sln编译解决方案中的任何其他程序集(与Visual Studio相同)? 另外,我还没有添加任何“bin”文件夹到Git.但是,我只是尝试这个测试,并没有改变Azure生成的编译错误. 解决方法
更新于11/25/2012:查看Dan的回购后,问题是库项目正在使用GAC中的Mvc 4,而不是使用NuGet软件包.切换到NuGet包使其在Azure上正常工作.
理论上,MVC4可能在Azure机器上的GAC中,这不是一个问题.也许他们会在某个时候到达那里.虽然一般来说,MVC团队正在越来越多地推出一个基于NuGet的模式,您不会依赖于GAC中的内容. 原来的答案: 一般来说,您应该避免将二进制文件提交给您的git repo,而是依靠NuGet来检索它们.请参阅https://github.com/KuduApps/Mvc4ApplicationFx40WithLib获取一个示例项目,并在Azure网站中正常工作. 但是根据您的项目结构,我看到您的项目似乎使用C(.vcproj).如果是这样,那么可能的问题是,当通过git发布时,Azure网站今天可能不支持C.到目前为止,我不认为这是人们使用C#& VB.如果确实是这个问题,那么我建议你在https://github.com/projectkudu/kudu开个问题,所以我们可以正确的跟踪这个. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- asp.net – 正确使用标签前缀和标签名称?
- ASP.NET WEB API入门实例
- asp.net – IIS7和IE8 – 在相同版本的IE8上呈现不同的页面
- asp.net-mvc – ASP.NET中的Response.Write是一个坏主意吗?
- asp.net – 如何将母版页添加到已创建的webform中?
- asp.net-mvc – ASP.NET MVC路由和区域
- asp.net-mvc – 使用JSON结果填充下拉列表 – 使用MVC3,JQu
- database – 为什么Entity Framework类需要一个不相关类的虚
- 有没有人使用ASP.net(webforms)动态生成javascript和/或css
- 禁用默认按钮或输入密码在asp.net c#
- asp.net-mvc – ASP.NET MVC开源实境应用
- asp.net-mvc-3 – ASP.net MVC路由与可选的第一个
- asp.net-mvc – 在视图中显示包含MVC中继承的模型
- asp.net-mvc – 如何使用Html.Action?
- asp.net 4.0:是否有相当于ClientIDMode的INPUT的
- asp.net-mvc – MVC3:当我想从控制器访问模型数
- asp.net-mvc-3 – 在同一视图中更新多个项目
- asp.net-mvc – MS Ajax与jQuery在ASP.NET MVC应
- 图表 – 在Asp.net mvc中实施Google Analytics
- ASP.NET web.config文件中的环境变量