visual-studio - Visual Studio,csproj : How can I specify a linked file in DependentUpon?

标签 visual-studio csproj

假设我的项目中有一个default.aspx.cs,但我想让它依赖于链接的default.aspx 文件。例如:

<Content Include="..\somedir\default.aspx">
  <Link>Default.aspx</Link>
</Content>

这不起作用:

<Compile Include="default.aspx.cs">
  <DependentUpon>Default.aspx</DependentUpon>    
  <SubType>ASPXCodeBehind</SubType>
</Compile>

这也不起作用:

<Compile Include="default.aspx.cs">
  <DependentUpon>..\somedir\default.aspx</DependentUpon>    
  <SubType>ASPXCodeBehind</SubType>
</Compile>

对于两者,我都收到此错误:

The parent file, 'Default.aspx', for file 'default.aspx.cs' cannot be found in the project file.

是否可以让一个文件依赖于一个链接文件?

最佳答案

我尝试了同样的事情,但似乎不支持。检查这个:https://bitbucket.org/jfromaniello/nestin/issue/4/error-when-nesting-linked-files “DependentUpon 不适用于链接文件。”

关于visual-studio - Visual Studio,csproj : How can I specify a linked file in DependentUpon?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15373780/

相关文章:

c++ - Visual Studio 2008 Profiler - Instrumented 产生奇怪的结果

.net - 即使在Visual Studio中即使编译器有错误也会进行调试

visual-studio-code - 使用 xunit 在 webapi 应用程序上运行 dotnet 测试

c# - 如何获得我的 C# 项目之间的依赖关系图

c# - VS2017只用getter封装?

c++ - 介入时如何跳过VS 2008中的常见类(class)?

c# - MS-Build BeforeBuild 未触发

linux - 从外部文件而不是 .csproj 文件读取版本前缀

c# - 是否可以将 xaml.cs 连接到 VS2017 csproj 格式的相应 xaml?

c++ - ifstream::open 在 Visual Studio Debug模式下不工作