问题得到的AssemblyVersion到使用剃刀/ MVC3网页 [英] Problem getting the AssemblyVersion into a web page using Razor /MVC3

查看:143
本文介绍了问题得到的AssemblyVersion到使用剃刀/ MVC3网页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用在页脚下面code在我_Layout.cshtml文件把程序集信息版本数据到每一个网页在我的网站MVC3页脚。但是:

I'm using the following code in a footer in my _Layout.cshtml file to put the AssemblyInfo version data into the footer of every page in my MVC3 site. However:

@System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()

只是打印在页脚:

Just prints in the footer:

Revision 0.0.0.0

当我修改视图来显示所有的执行大会,大会信息的使用以下

When I modified the view to display all of the assembly info for the "Executing Assembly" using the following

@System.Reflection.Assembly.GetExecutingAssembly().GetName().ToString()

它打印以下内容:

Which prints the following:

Revision App_Web__layout.cshtml.639c3968.hlogy75x, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null

这表明,执行大会是不是我的主要的应用程序,它的观点本身。

This shows that the "Executing Assembly" isn't my main app, it's the view itself.

如何才能获得实际的应用程序集信息,而不只是个人意见?

推荐答案

CSHTML / vbhtml是动态编译装配。

cshtml/vbhtml is dynamic compile to assembly.

@typeof(YourApplicationNamespace.MvcApplication).Assembly.GetName().Version

这个怎么样?

这篇关于问题得到的AssemblyVersion到使用剃刀/ MVC3网页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆