Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trouble finding targets for Autofac #57

Closed
daveaglick opened this issue Jun 21, 2018 · 4 comments
Closed

Trouble finding targets for Autofac #57

daveaglick opened this issue Jun 21, 2018 · 4 comments

Comments

@daveaglick
Copy link
Collaborator

I introduced some integration tests and am now seeing the following error when building Autofac (cc @JasonBock)

Project "E:\Code\Buildalyzer\tests\repos\Autofac\src\Autofac\Autofac.csproj" (Clean target(s)):

Target Clean:
    __________________________________________________
    Project "E:\Code\Buildalyzer\tests\repos\Autofac\src\Autofac\Autofac.csproj" is building "E:\Code\Buildalyzer\tests\repos\Autofac\src\Autofac\Autofac.csproj" (Clean target(s)):

    C:\Program Files\dotnet\sdk\2.1.300\Sdks\Microsoft.NET.Sdk\Sdk\Sdk.targets(41,3): error MSB4019: The imported project "E:\NuGet\microsoft.testplatform.testhost\15.7.2\lib\netstandard1.5\Microsoft.CSharp.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

    Done building project "Autofac.csproj" -- FAILED.
@daveaglick
Copy link
Collaborator Author

Looks like MSBuildToolsPath is getting incorrectly set - here's Sdk.targets:

  <PropertyGroup Condition="'$(LanguageTargets)' == ''">
    <LanguageTargets Condition="'$(MSBuildProjectExtension)' == '.csproj'">$(MSBuildToolsPath)\Microsoft.CSharp.targets</LanguageTargets>
    <LanguageTargets Condition="'$(MSBuildProjectExtension)' == '.vbproj'">$(MSBuildToolsPath)\Microsoft.VisualBasic.targets</LanguageTargets>
    <LanguageTargets Condition="'$(MSBuildProjectExtension)' == '.fsproj'">$(MSBuildThisFileDirectory)..\targets\Microsoft.NET.Sdk.FSharpTargetsShim.targets</LanguageTargets>

    <!-- If LanguageTargets isn't otherwise set, then just import the common targets.  This should allow the restore target to run,
         which could bring in NuGet packages that set the LanguageTargets to something else.  This means support for different
         languages could either be supplied via an SDK or via a NuGet package. -->
    <LanguageTargets Condition="'$(LanguageTargets)' == ''">$(MSBuildToolsPath)\Microsoft.Common.CurrentVersion.targets</LanguageTargets>
  </PropertyGroup>

Could be related to #29 given that Autofac multi-targets:

<TargetFrameworks>netstandard1.1;net45</TargetFrameworks>

But removing the net45 target doesn't improve the situation, so maybe not.

@daveaglick
Copy link
Collaborator Author

After removing the net45 target to reduce the chance this is a multi-targeting problem, it looks like some of the MSBuild properties are getting reset:

2018-06-21_09h31_34

No idea why this is happening. It looks similar to what happens when you multi-target, except there's no multi-targeting going on.

@daveaglick
Copy link
Collaborator Author

Okay, now it makes more sense - confirmed this first error at least is due to multi-targeting (#29), I had forgotten to change <TargetFrameworks> to <TargetFramework> when removing the second target. If I change all projects to single-target, Buildalyzer successfully builds the solution.

So I guess it's time to finally figure out how to handle multi-targeting.

daveaglick added a commit that referenced this issue Jun 21, 2018
…ansformer, strips multiple targets from mutli-targeted projects (#29, #57)
@daveaglick
Copy link
Collaborator Author

Resolved with the latest commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant