Visual Studio 2015 project builds failed but no er

2019-01-21 05:28发布

My project builds all fail but I'm not shown any errors. I tried cleaning and rebuilding, that didn't work.

I changed the MSBuild output verbosity to 'Diagnostic' hoping it would help me identify the problem and now I'm stuck. Here's what the output looks like:

1>Project 'ProjectMM.Data.Models' is not up to date. Input file 'C:\Projects\ProjectMM\ProjectMM.Data.Models\ProjectMM.Data.Models.csproj' is modified after output file 'C:\Projects\ProjectMM\ProjectMM.Data.Models\bin\Debug\ProjectMM.Data.Models.pdb'.
All packages are already installed and there is nothing to restore.
1>------ Build started: Project: ProjectMM.Data.Models, Configuration: Debug Any CPU ------
2>Project 'ProjectMM.Data' is not up to date. Input file 'C:\Projects\ProjectMM\ProjectMM.Data\ProjectMM.Data.csproj' is modified after output file 'C:\Projects\ProjectMM\ProjectMM.Data\bin\Debug\ProjectMM.Data.pdb'.
2>------ Build started: Project: ProjectMM.Data, Configuration: Debug Any CPU ------
3>Project 'ProjectMM' is not up to date. Input file 'c:\projects\projectmm\projectmm\app_start\bundleconfig.cs' is modified after output file 'C:\Projects\ProjectMM\ProjectMM\bin\ProjectMM.pdb'.
3>------ Build started: Project: ProjectMM, Configuration: Debug Any CPU ------
========== Build: 0 succeeded, 3 failed, 0 up-to-date, 0 skipped ==========

24条回答
来,给爷笑一个
2楼-- · 2019-01-21 05:40

For me, it was a rogue attached property. The problem wasn't necessarily that I couldn't see an error; the error was the following:

Child node "2" exited prematurely. Shutting down. Diagnostic information may be found in files in the temporary files directory named MSBuild_*.failure.txt.

Initially, the build would hang and not show any errors unless you attempted to close Visual Studio. After restarting, it would hang for a long period upon building, then display the above message.

Deleting hidden .vs folder, rebuilding/cleaning solution, and restarting Visual Studio did not work. Removing the attached property did; ergo, it could be actual code somewhere that isn't working properly.

As a last resort, I would remove any recent changes one by one until the issue is resolved as none of the solutions here helped.

Update

Because I'm used to developing traditional WPF applications, I didn't realize you can't have "chained" XAML namespaces using .s with UWP. I was attempting to set an attached property using

My.Namespace:SomeClass.SomeProperty="SomeValue"

Whereas, it should just be

MyNamespace:SomeClass.SomeProperty="SomeValue"

It's not as pretty as I like, but it's the only way to go, apparently.

查看更多
三岁会撩人
3楼-- · 2019-01-21 05:44

I had this problem and it turned out that I had a using pointing to an empty namespace. Removing that using clause fixed the problem

查看更多
等我变得足够好
4楼-- · 2019-01-21 05:45

Check the warnings..

I had the new class library with target .Net Framework 4.5 while the referencing project was 4.0 which caused reference issue.

After modifying the class library with target .Net Framework 4.0 it worked correctly.

查看更多
forever°为你锁心
5楼-- · 2019-01-21 05:45

Try this

Excluding "mstscax.dll" from the Dependencies worked for me.

查看更多
手持菜刀,她持情操
6楼-- · 2019-01-21 05:46

It's possible that you're not seeing all the build errors.

By changing the drop down list after the "Messages" icon from "Build + Intellisense" to "Build Only", you will be able to see errors thrown during the build that are not detected by Intellisense. See the screenshot below:

Build

查看更多
Luminary・发光体
7楼-- · 2019-01-21 05:46

For me this issue was related to a custom CodeAnalysis ruleset setting "IncludeAll".

It appears the Compiler observes this setting:

  <IncludeAll Action="Error" />

But IntelliSense took the default ACTION on the Rule Id which was "Warning". This would explain the behavior seen by @RobertHarvey where you filter the output by Build Only and it shows as an ERROR, but if you filter by Intellisene Only it shows as WARNING. Filtering output by the default Build + Intellisense seems non-deterministic!

My fix was to explicitly call out the rule that i wanted to be a warning as a warning.

  <Rules AnalyzerId="Microsoft.CodeAnalysis.CSharp" RuleNamespace="Microsoft.CodeAnalysis.CSharp">
    <Rule Id="CS0618" Action="Warning" />
  </Rules>

This is potentially a problem with Intellisense not observing the IncludeAll option. See https://github.com/dotnet/roslyn/issues/7400

查看更多
登录 后发表回答