Ton*_*Nam 16 code-behind visual-studio-2012
我想将包含xaml和cs文件以及其他目录的文件夹添加到VS上的其他项目中.出于某种原因,当我将文件夹从Windows资源管理器拖到我想要放置该目录的项目时,visual studio不会让我.因此我手动添加每个文件,每次遇到目录时都要创建它.也许是因为我正在使用团队基础服务器.
无论如何我手动添加文件所以我点击我要在visual studio上添加文件的文件夹然后点击添加现有文件.然后我选择xaml和代码隐藏文件:
当我点击添加文件时添加但Visual Studio无法识别Bytes.xaml.cs是背后的代码!
我是否必须手动添加窗口然后复制并粘贴文件的内容?
Vas*_*han 22
编辑你的.csproj文件,在.xaml.cs文件的"Compile"元素下面添加一个"DependentUpon"元素,这样它就会出现在.xaml文件的"里面",而不仅仅是在它下面:
<Compile Include="BytesDisplay\SubControls\Bytes.xaml.cs">
<DependentUpon>Bytes.xaml</DependentUpon>
</Compile>
Run Code Online (Sandbox Code Playgroud)
要轻松编辑.csproj文件:
Right-click the project and select "Unload Project"
Right-click the project node again and select "Edit [projectname].csproj"
Edit the XML, then close the file
Right-click the project node again and select "Reload Project"
Run Code Online (Sandbox Code Playgroud)
小智 11
如果将.xaml文件从Windows资源管理器拖放到"解决方案资源管理器"窗口中,它将自动添加带有代码隐藏.cs文件的.xaml文件.
归档时间: |
|
查看次数: |
6266 次 |
最近记录: |