ASP.Net - 从 Visual Studio 2003 过渡到 Visual Studio 2010

发布于 2024-12-04 00:34:07 字数 1159 浏览 2 评论 0原文

我们正在将 ASP.Net 开发从 Visual Studio 2003 和 .Net 1.1 切换到 Visual Studio 2010 和 .Net 3.5。到目前为止,我们成功迁移了后端代码,经过一番努力,我们也成功迁移了 ASP.Net 前端代码。虽然后端代码的工作以正常的生产力恢复,但由于以下问题,ASP.Net 前端代码的工作受到严重阻碍:

  • Visual Studio 2010 Web Designer 频繁崩溃(例如,在使用“撤消”功能后) ) - 我们已经习惯了 Visual Studio 2003 Web Designer 在处理大型 Web 表单时存在的稳定性问题,但新的 Web Designer 即使处理简单的 Web 表单也会经常崩溃。有什么办法可以让事情稳定下来吗? ServicePack 1 没有带来任何帮助。

  • 在 Web 设计器中向 Web 表单添加新控件时,新控件的声明将永远自动传播到迁移的 Web 表单中的代码隐藏页面。从头开始创建的新网络表单似乎工作正常。迁移的 Web 表单保留旧的文件结构(aspx、aspx.cs 和 aspx.resx),而新的 Web 表单获得新的文件结构(aspx、aspx.cs 和 aspx.designer.cs)。 重新创建所有现有 Web 表单 将是一个非常痛苦的操作,是否有一种方法可以在 Visual Studio 2010 中使控件声明到文件后面的代码的旧的正常工作传播工作?

  • (目前我们最大的问题):在设计Web表单时,我们基本上将文本框,标签,按钮等放在一个带有ms_positioning =“GridLayout”的div中。我们为 div 中的每个控件定义绝对坐标。这在 Visual Studio 2010 中似乎无法正常工作。经过大量的努力,我们可以以某种方式继续使用这种方法,但是向 Web 表单添加新的按钮或文本框现在意味着需要付出巨大的努力。如果不特别注意,它甚至可能会导致 css-classes-file 的覆盖(Web 设计者有时决定不在 aspx 文件中写入坐标,而是在 css 文件中写入)。我最近读到,使用绝对坐标在网页上定位内容是一种非常糟糕且已弃用的方法。我倾向于相信它是在新的 Visual Studio 中完成的,这是多么可怕的事情。但是快速创建类似 winforms 的 Web 表单的正确方法是什么? (“快速”是指简单的拖放点单击设计方式)。

预先感谢您的任何帮助。

此致 埃里希·霍拉克

we are in process of switching our ASP.Net development from Visual Studio 2003 and .Net 1.1 to Visual Studio 2010 and .Net 3.5. So far, we successfully migrated our back end code and after some fight the ASP.Net front end code too. While the work on the back end code resumed with usual productivity, working on the ASP.Net front end code is massively hampered because of following issues:

  • The Visual Studio 2010 Web Designer crashes frequently (e. g. after using the "Undo" function) - we are used to the stability problems of Visual Studio 2003 Web Designer when working with large web forms, but the new Web Designer crashes frequently even with trivial web forms. Is there anything to make the thing stable? ServicePack 1 brought no help.

  • When adding new controls to a webform in the web designer, the declaration of the new control will never automatically propagate to the code behind page in the migrated web form. New web forms created from scratch seem to work ok. The migrated web forms maintain the old file structure (aspx, aspx.cs and aspx.resx), while the new web forms get a new file structure (aspx, aspx.cs and aspx.designer.cs. Recreating all the existing web forms manually to get the new file structure would be a very painful operation. Is there a way to make the old decent working propagation of controls' declaration to code behind file work in Visual Studio 2010 too?

  • (Currently our biggest problem): when designing a web form, we basically put the textboxes, labels, buttons etc. in a div with ms_positioning="GridLayout". We define absolute coordinates for every control in the div. This doesnot seem to work properly in Visual Studio 2010. With a lot of effort we can somehow continue using this approach, but adding a new button or textbox to a web form means massive effort now. Without paying really much attention it can even result in overwritig of the css-classes-file (the Web Designer sometimes decides to write the coordinates not in the aspx file but in the css file). I read recently that using absolute coordinates to position stuff on a web page is a very bad and deprecated approach. I tend to believe it seeing how gruesome it has to be done in the new Visual Studio. But what is the correct way to create winforms-like web forms rapidly? (With rapidly I mean simple drag-drop-point-click way of designing stuff).

Thanks in advance for any help.

Best Regards
Erich Horak

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

两个我 2024-12-11 00:34:07

我将尝试按问题解决此问题:

设计器

不幸的是,Visual Studio 2010 中的新设计器一直受到问题的困扰。 2010 年,该编辑器使用 WPF 进行了彻底改造,本应使其速度更快,但迄今为止似乎不如以前的编辑器。有一些改进,但如果我有选择的话,我会坚持使用旧编辑器,至少直到用新编辑器解决问题为止。这可能算不上什么安慰,但你并不是唯一感受到这种痛苦的人。

添加控件/新的页面文件结构

同样,这是另一种迁移过程会很痛苦的情况。如果我建议一种方法,我会将标记复制粘贴到新创建的表单(使用 VS 2010 创建)中。 Designer.cs 文件应注册控件。您可能会遇到事件处理程序映射问题,但希望它不会妨碍 Designer.cs 文件注册控件。我知道这是一个痛苦的前景,但您必须记住,您正在升级多个版本。

设计师观点&绝对定位

当您迁移系统时,您可能希望将默认视图设置为源视图,以便可以将 HTML 粘贴到页面上。您可以通过转到 Tools > 来完成此操作。选项> HTML 设计器 >一般。老实说,在我看来,这个设计师真的很脆弱,应该避免。它生成的 HTML 确实很糟糕。

使用绝对坐标在页面上定位元素肯定是一种不推荐的方法,但如果您此时的目标是让迁移正常工作,那么现在不用担心。最终,重构 HTML 和 CSS 以使用更现代的技术是一个好主意,但如果当前的代码库与浏览器兼容,则暂时保留它。

乍一看可能不像,但如果您可以摆脱设计器并使用源视图,您就不会后悔。一开始确实需要多一点时间,但从长远来看,控制标记最终将为您节省大量时间。如果允许设计者在整个系统中肆意妄为,它就会把事情搞砸。通过使用源代码视图,您可以完全控制正在发生的一切,这将成为一个巨大的优势。通过利用母版页等新功能,您可以像在 1.1 的设计器视图中一样快速地在源代码视图中移动。我自己在 1.1 中开始使用设计器视图,但切换到源代码视图后,我再也没有回头。你确实可以通过其他方式来提高生产力。

我希望我能给你一个“这样做,一切都会就位”的答案,但我认为你正在经历一个痛苦的转换过程。好消息是,一旦完成,您就可以开始利用过去 8 年中出现的所有新功能。 ;)

I'll try to tackle this issue by issue:

Designer

Unfortunately, the new designer in Visual Studio 2010 has been plagued with issues. With 2010, the editor was completely revamped with WPF, which was supposed to make it faster, but thus far has seemed inferior to the previous editors. There are some improvements, but if I had an option to choose I would stick with the old editor, at least until the issues are worked out with the new one. It may not be any consolation, but you are not the only one feeling that pain.

Adding controls/new page file structure

Again, this is another situation where migration will prove painful. If I were to suggest an approach, I would copy paste the markup into newly created forms (created w/ VS 2010). The designer.cs file should register the controls. You might run into issues with event handler mappings, but hopefully it won't get in the way of the designer.cs file registering the controls. I know this is a painful prospect, but you have to keep in mind that you're moving up several versions.

Designer view & absolute positioning

While you're migrating the system, you might want to set the default view to source-view, so you can paste the HTML onto the page. You can do this by going to Tools > Options > HTML Designer > General. Honestly, in my opinion, the designer is really flaky and should be avoided. The HTML it produces really is horrible.

Using absolute coordinates to position elements on a page is a deprecated approach for sure, but if your goal at this point is to get your migration working, then don't worry about it for now. Eventually, it would be a good idea to refactor your HTML and CSS to use more modern techniques, but if the current code-base is browser-compatible, then leave it for now.

It may not seem like it at first, but if you can move away from the designer and use the source view, you won't regret it. It does take a little more time at first, but having control over the markup will end up saving you a lot of time in the long run. If the designer is allowed to run rampant throughout the system, it will screw things up. By using the source view, you have full control over everything that's happening, which will become a huge advantage. By leveraging new features like master pages, you can move just as quickly in the source-code view as in the designer view of 1.1. I started out with the designer-view myself in 1.1, but after switching to the source-view, I never looked back again. You really do make up the productivity in other ways.

I wish I could give you a "do this and everything will snap into place" kind of answer, but I think you're in for a painful conversion process. The good news is, once it's done you can start utilizing all of the new features that have come around in the past 8 years. ;)

孤独难免 2024-12-11 00:34:07

我看不出有什么快速、拖拽的方法。删除执行此操作的方法。像 GridLayout 这样的东西已被弃用;从长远来看,手动移植表单、清理标记并使用表单的代码视图而不是设计视图要容易得多。这也是编写干净、独立的 CSS 而不是内联样式的机会。

1.1 后,您不需要在代码隐藏中声明表单元素 - 新的分部类消除了这种需要。所以这只是另一件事不同。我现在实际上正在做一个类似的项目;我利用了新的大师班,这意味着无论如何都要改变很多。

我诚实的建议是忍住并继续前进:)

我在这里问了类似的问题:

Visual Studio 多项目解决方案选项

I see no quick, drag & drop way of doing this. Things like GridLayout are deprecated; much easier in the long run to port the forms manually, cleaning up the markup as you go and using the code view of the forms instead of the design view. Also an opportunity to write clean, separate CSS rather than inline styles.

Post 1.1, you do not need to declare the form elements in the code-behind - the new partial classes obviate the need for that. So this is just one more thing that is different. I am actually working on a similar project right now; I availed of the new master classes which meant changing quite a bit anyway.

My honest advice is to suck it up and move on :)

I asked a similar question here:

Visual Studio Multi-Project Solution Options

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文