Visual Studio中忽略的MSBuild文件(的csproj)自定义 [英] Visual Studio Ignoring MSBuild file (csproj) Customizations

查看:329
本文介绍了Visual Studio中忽略的MSBuild文件(的csproj)自定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

注:的Visual Studio 2010 SP1 /的MSBuild 4.0

我要疯了这个错误,我不明白为什么Visual Studio是表现这种方式。我在一个特定的解决方案编写自定义的 .targets 文件为我的项目。我已经编辑了 .csproj的的文件有:

I'm going crazy over this bug, I cannot understand why Visual Studio is behaving this way. I'm writing a custom .targets file for my projects in a particular solution. I've edited the .csproj file to have:

<Include Project="..\MyTargets.targets" />

Microsoft.CSharp.targets 文件的底部附近。我们的想法是,这个目标文件将注入行动,通过修改 _____ DependsOn 属性只是怎么样的 PostSharp 集成本身。

After Microsoft.CSharp.targets near the bottom of the file. The idea is that this targets file will inject actions to be performed by modifying the _____DependsOn properties just like how PostSharp integrates itself.

在抓我的头怎么我的目标将无法运行,我决定与MSBuild的命令行中运行它,看看格式良好的彩色输出。

After scratching my head at how my targets would not run I decided to run it in the command line with MSBuild and see the nicely formatted color output.

在命令行中,我的目标运行。从Visual Studio(甚至使用清洁/重建),我的目标不运行

In the command line, my targets run. From visual studio (even using clean/rebuild), my targets do not run.

我已经迷上 BuildDependsOn 来运行我的目标是这样的:

I've hooked BuildDependsOn to run my targets like this:

<PropertyGroup>
  <BuildDependsOn>
    MyTargetGoesHere;
    $(BuildDependsOn)
  </BuildDependsOn>
</PropertyGroup>

我首先想到的是,我已经得到了错误的文件。我验证文件,这是正确的。然后我检查,看它是否已过时。让视觉工作室做一些改变,保存,跑了。 Visual Studio的新变化生效,还是没跑我的目标。

My first thought is that i've got the wrong file. I verified the file, it's the right one. Then I checked to see if it was stale. Let visual studio make some changes, saved, ran. Visual studio's new changes took effect, still didn't run my targets.

所以在这里,我越来越绝望。我把刺耳的语法错误我的目标文件。 MSBuild的爆炸,Visual Studio中成功地编译项目。

So here I'm getting desperate. I put a BLARING SYNTAX ERROR in my targets file. MSBuild explodes, Visual Studio compiles the project successfully.

  • 我究竟做错了什么?
  • 难道Visual Studio中不能使用的MSBuild文件?
  • 是否调用一些超级秘密的目标,而不是建设从 Microsoft.Common.targets
  • 为什么会MSBuild的行为的一种方式和工作室另一个,我以为他们是设计为一起工作...
  • What am I doing wrong?
  • Does Visual Studio not use the MSBuild file?
  • Does it call some super secret target instead of "Build" from Microsoft.Common.targets?
  • Why would msbuild behave one way and studio another, I thought they were designed to work together...

推荐答案

要总结上述意见,修改导入的项目文件不会触发重载,也不会改变进口项目导致进口的重载。解决方案文件重装是需要捕捉的进口所做的更改。

To summarize the comments above, changes to imported project files do not trigger a reload, nor do changes to the importing project cause a reload of the imports. A solution file reload is needed to capture changes made in an import.

这篇关于Visual Studio中忽略的MSBuild文件(的csproj)自定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆