我有一个WebApplication包含引用WCF服务。

在使用Visual Studio 2010构建时,构建失败,没有任何错误或警告。但是使用MsBuild构建.csproj是成功的。

不知道我应该在Visual Studio中尝试什么来解决/诊断问题。你能帮帮我吗?

我发现构建一直在失败,

从状态栏中显示的文本。 从输出窗口: ========== 构建:0成功或更新,1失败,0跳过 ========== 输出选项卡包含配置详细信息。 ------构建开始:项目:<projectName here>配置:调试任何CPU


当前回答

再次检查_下划线。项目中的Aspx页。

我有一个页面和暗号:

`myPage.aspx` and `myPage.aspx.vb`

当构建项目时,我会在.aspx.vb页面上得到错误,说明在.aspx页面上定义的属性不存在,即使页面本身会构建良好,并且在输出中没有其他错误显示(即使是诊断级构建输出)。

然后,我在项目中遇到了一个页面,它的名称与此相同,但带有下划线:_myPage。aspx -不知道它来自哪里,我删除了它,解决方案构建良好。

其他回答

再次检查_下划线。项目中的Aspx页。

我有一个页面和暗号:

`myPage.aspx` and `myPage.aspx.vb`

当构建项目时,我会在.aspx.vb页面上得到错误,说明在.aspx页面上定义的属性不存在,即使页面本身会构建良好,并且在输出中没有其他错误显示(即使是诊断级构建输出)。

然后,我在项目中遇到了一个页面,它的名称与此相同,但带有下划线:_myPage。aspx -不知道它来自哪里,我删除了它,解决方案构建良好。

什么都不能为我工作,所以我删除了.suo文件,重新启动VS,清理投影,然后构建将工作。

在我的情况下(VS 2019 v16.11.20),禁用文本编辑器-> c# ->高级->在选项中启用“拉”诊断解决了这个问题。

我也遇到过类似的情况。在我的案例中,出现在csproj文件的BeforeBuild目标中的自定义操作(来自Nuget.org - http://www.nuget.org/packages/MSBuildVersioning/上提供的MSBuildVersioning包)失败了,没有在正常的地方触发任何错误消息。

我可以通过设置“MSBuild项目构建输出verbose”(在最新的Visual Studio的工具选项卡[路径:Tools > Options >构建和运行])为“诊断”来确定这一点,如下所示。这表明自定义操作(在我的例子中是HgVersionFile)失败了。

这里有一些你可以尝试的方法:

If your solution contains more than one project, try building each project one at a time. (You may even want to try opening each project independently of the solution.) If applicable, ensure that all of your projects (including dependencies and tests) target the same version of the .NET Framework. (Thanks to user764754 for this suggestion!) Tip: Check Tools → Extension and Updates to ensure that your packages are up-to-date. Ensure that all dependency projects are built to target the same platform as your main project. Try restarting Visual Studio. As suggested by Bill Yang, try running Visual Studio as Administrator, if you aren't already. (If you are already running Visual Studio as Administrator, perhaps try the opposite?) Try restarting your computer. Try "Rebuild All". Run "Clean Solution", then remove your *vspscc* and *vssscc* files, restart Visual Studio, and then "Rebuild All". As suggested by Andy, close Visual Studio, delete the .suo file, and restart Visual Studio. As suggested by Arun Prasad E S, close Visual Studio, delete the .vs folder in your solution directory, and then re-open Visual Studio. (This folder is auto-generated by Visual Studio and contains cache, configuration settings, and more. More details can be found in these questions: Visual Studio - Deleting .vs folder and https://stackoverflow.com/q/48897191.) As suggested by MrMalith, close Visual Studio, delete the obj folder in your solution directory, clear your temporary folder, and then re-open Visual Studio.