奇怪的“Designer1.cs”创建的文件

发布于 2024-08-27 13:33:14 字数 152 浏览 3 评论 0原文

Visual Studio 如何将文件链接到相应的 Designer.cs 文件?我遇到了一种奇怪的情况,DataSet 设计器和 L2S DBML 设计器都忽略了 DataSet.Designer.cs,而是创建并使用了 DataSet.Designer1.cs。我怎样才能把它切换回来?

How does visual studio link files to their corresponding designer.cs files? I have a strange situation that's occurred with both the DataSet designer and also the L2S DBML designer where it's ignoring the DataSet.Designer.cs and has created and used a DataSet.Designer1.cs instead. How can I switch it back?

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

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

发布评论

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

评论(3

旧夏天 2024-09-03 13:33:14

感谢 Zendar 的建议,这就是我所做的:

  1. 关闭 Visual Studio。
  2. 使用 TortoiseSVN 将 DataContext1.designer.cs 文件重命名为 DataContext.designer.cs,以便源代码管理系统拾取重命名。
  3. 在文本板中打开 MyProject.csproj
  4. 执行搜索并将 DataContext1.designer 替换为 DataContext.designer(找到 2 个实例)。
  5. 保存并关闭。

在 Visual Studio 中重新打开并构建解决方案证实了这一点。谢谢赞达尔!

Thanks to Zendar's suggestion, this is what I did:

  1. Close Visual Studio.
  2. Use TortoiseSVN to rename the DataContext1.designer.cs file to DataContext.designer.cs, so the rename is picked up by source control.
  3. Opened MyProject.csproj in Textpad.
  4. Performed search and replace for DataContext1.designer with DataContext.designer (found 2 instances).
  5. Save and close.

Re-opening and building the solution in Visual Studio confirmed this worked. Thanks Zendar!

深府石板幽径 2024-09-03 13:33:14

相关文件的信息写入项目文件(*.csproj)中。这可能会解决问题:

  1. 从项目中排除DataSet设计器
  2. 关闭Visual studio
  3. 从磁盘中删除Designer1.cs
  4. 从磁盘中删除Designer.cs(如果存在)
  5. 启动Visual studio
  6. 打开DataSet设计器
  7. 现在您应该有Designer.cs

替代方法是尝试更改*.csproj 文件中的信息,然后在出现的所有位置将 Designer1 重命名为 Designer。我没有尝试这个,但它可能会起作用。

Information about related files is written in project files (*.csproj). This may fix problem:

  1. exclude DataSet designer from project
  2. close Visual studio
  3. remove Designer1.cs from disk
  4. remove Designer.cs from disk (if it exists)
  5. start Visual studio
  6. open DataSet designer
  7. now you should have Designer.cs

Alternative would be to try to change information in *.csproj file and then to rename Designer1 to Designer in all places it occurs. I did not try this, but it may work.

在巴黎塔顶看东京樱花 2024-09-03 13:33:14

.csproj 文件中的 设置不正确。一旦更新,就不再为我生成额外的文件。

<LastGenOutput> was set improperly in the .csproj file. Once that was updated, the extra file stopped being generated for me.

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