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

Warnings on <Sdk /> style import #97

Closed
andrew-boyarshin opened this issue Jul 22, 2018 · 4 comments
Closed

Warnings on <Sdk /> style import #97

andrew-boyarshin opened this issue Jul 22, 2018 · 4 comments

Comments

@andrew-boyarshin
Copy link
Contributor

andrew-boyarshin commented Jul 22, 2018

MSBuild warnings:

C:\Users\<user>\.nuget\packages\msbuild.sdk.extras\1.6.41\Sdk\Sdk.props(11,3): warning MSB4011: "C:\Program Files\dotnet\sdk\2.1.400-preview-009063\Sdks\Microsoft.NET.Sdk\Sdk\Sdk.props" cannot be imported again. It was already imported at "<project path>\project.csproj". This is most likely a build authoring error. This subsequent import will be ignored.
C:\Users\<user>\.nuget\packages\msbuild.sdk.extras\1.6.41\Sdk\Sdk.targets(15,3): warning MSB4011: "C:\Program Files\dotnet\sdk\2.1.400-preview-009063\Sdks\Microsoft.NET.Sdk\Sdk\Sdk.targets" cannot be imported again. It was already imported at "<project path>\project.csproj". This is most likely a build authoring error. This subsequent import will be ignored.

Sample project:

<Project Sdk="Microsoft.NET.Sdk">
  <Sdk Name="MSBuild.Sdk.Extras" />
  <Sdk Name="Microsoft.Build.CentralPackageVersions" />
  <PropertyGroup>
    <TargetFramework>net472</TargetFramework>
    <ExtrasEnableWpfProjectSetup>true</ExtrasEnableWpfProjectSetup>
  </PropertyGroup>
</Project>

I believe some checks are needed in Sdk\Sdk.props and Sdk\Sdk.targets not to import Microsoft.NET.Sdk if already imported, since <Sdk /> imports are valid scenario too (I believe they are much more maintainable than <Project Sdk="" />).

@clairernovotny
Copy link
Collaborator

Hi,

The extras should be in place of the Microsoft.NET.Sdk in the Project element. It will include that in the correct locations.

@andrew-boyarshin
Copy link
Contributor Author

@onovotny of course I know that. The issue is about support of almost identical method: <Sdk />. It presents almost the same import behavior while preserving Project SDK.

@clairernovotny
Copy link
Collaborator

That cannot work though due to ordering requirements. The extras needs things both before and after the main SDK targets to work. Thats why it does the import.

@andrew-boyarshin
Copy link
Contributor Author

andrew-boyarshin commented Jul 24, 2018

I see. Makes sense. Still, that's unfortunate limitation. Linking msbuild issue for reference. Feel free to close this if you believe this is not an issue then.

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

2 participants