gpt4 book ai didi

c# - "Include in Project"Visual Studio 2013 中数据集的异常行为

转载 作者:可可西里 更新时间:2023-11-01 07:58:13 25 4
gpt4 key购买 nike

我想做一件非常简单的事情:将 VS13 中的一些代码从一个项目移到另一个项目中,我正面临数据集的奇怪问题。为简单起见,假设在我的源项目中我有一个名为 MyDataSet 的数据集,它由 5 个文件组成:MyDataSet.csMyDataSet.Designer.csMyDataSet.xscMyDataSet.xsdMyDataSet.xss

然后我使用标准 Windows 功能将这些文件复制到我的目标项目文件夹,并使用 VS13 中的 Include in Project 菜单选项。之后我看到添加了一个额外的文件:MyDataSet1.Designer.cs

我试图检查 cproj 文件,它们是不同的。

来源(仅显示与目标不同的部分):

<Compile Include="MyDataSet.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>MyDataSet.xsd</DependentUpon>
</Compile>

<None Include="MyDataSet.xsd">
<SubType>Designer</SubType>
<Generator>MSDataSetGenerator</Generator>
<LastGenOutput>MyDataSet.Designer.cs</LastGenOutput>
</None>

目标(仅显示与源不同的部分):

<Compile Include="MyDataSet.Designer.cs">
<DependentUpon>MyDataSet.cs</DependentUpon>
</Compile>

<Compile Include="MyDataSet1.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>MyDataSet.xsd</DependentUpon>
</Compile>

<None Include="MyDataSet.xsd">
<Generator>MSDataSetGenerator</Generator>
<LastGenOutput>MyDataSet1.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</None>

我还注意到,在 MyDataSet.csMyDataSet1.Designer.cs 中,命名空间自动更改为正确的名称。

我正在使用 ReSharper,起初我认为这可能是一个原因,但我 disabled ReSharper并且相同的行为继续发生。

也许我可以通过删除新创建的文件和修改 cproj 文件来解决这个问题,但实际上我需要复制很多数据集,我真的不喜欢那种工作。

有没有人知道这种问题的原因是什么以及如何解决?

最佳答案

通过右键单击解决方案资源管理器中的数据集根节点(通常是 .xsd)并选择“复制”,从 Visual Studio 中移动数据集,然后右键单击目标项目或项目文件夹并选择“粘贴”。这应该复制文件并正确标记 csproj 文件。

关于c# - "Include in Project"Visual Studio 2013 中数据集的异常行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29609528/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com