Skip to content

MSB4019: The imported project "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Sdks\Microsoft.NET.Sdk.Web\Sdk\Sdk.props" was not found #2163

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

Closed
avikenjale opened this issue Jun 2, 2017 · 10 comments
Labels

Comments

@avikenjale
Copy link

I have following scenario about this issue:

  1. I have developed my .net core webApi with Visual studio 2017
  2. Locally it builds and runs as expected.
  3. We use Bamboo for build and deployment.
  4. When I configure build plan under bamboo I'm getting error for one of project under solution as error MSB4041: The default XML namespace of the project must be the MSBuild XML namespace. If the project is authored in the MSBuild 2003 format, please add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the <Project> element. If the project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format..

I have following setting for MSBuild:
image

@rainersigwald
Copy link
Member

To build a .NET Core project (using the new, more compact XML), you must use MSBuild 15 or higher. This is the error you get when using an older MSBuild, and I see that you're specifying MSBuild v14.0 (32bit) in the configuration you posted.

You'll need to select whatever Bamboo calls MSBuild v15 (or Visual Studio 2017).

@avikenjale
Copy link
Author

avikenjale commented Jun 6, 2017

@rainersigwald, I installed MSBuild 15.0 on my Bamboo server, however now I am running with following error:

error MSB4019: The imported project "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Sdks\Microsoft.NET.Sdk.Web\Sdk\Sdk.props" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.

NOTE: If I run MsBuild thru my command line on my local machine, solution builds properly without error.

Following is my one of BuinessLibrary.csproj file:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <RuntimeFrameworkVersion>1.0.4</RuntimeFrameworkVersion>
  </PropertyGroup>
  <PropertyGroup>
    <TargetFramework>netstandard1.6</TargetFramework>
  </PropertyGroup>
</Project>

WebApi.csproj

<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
  <RuntimeFrameworkVersion>1.0.4</RuntimeFrameworkVersion>
</PropertyGroup>
<PropertyGroup>
    <TargetFramework>netcoreapp1.1</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <Folder Include="Controllers\" />
    <Folder Include="wwwroot\" />
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.0" />
    <PackageReference Include="Microsoft.AspNetCore" Version="1.1.2" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.2" />
    <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.2" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc.Formatters.Xml" Version="1.1.2" />
    <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.2" />
    <PackageReference Include="Newtonsoft.Json" Version="10.0.2" />
    <PackageReference Include="System.Linq" Version="4.3.0" />
    <PackageReference Include="System.Threading" Version="4.3.0" />
  </ItemGroup>
<ItemGroup>
    <ProjectReference Include="..\BusinessLibrary\BusinessLibrary.csproj" />
 </ItemGroup>
</Project>

@rainersigwald
Copy link
Member

@avikenjale How did you install MSBuild 15? To build SDK projects, you must install Visual Studio with the ".NET Core cross-platform development" workload selected.

@avikenjale
Copy link
Author

avikenjale commented Jun 6, 2017

@rainersigwald , I followed these steps:

  1. On the Visual Studio download page, expand Other Tools and Frameworks at the bottom of the page
    Download the Build Tools for Visual Studio 2017
  2. You can then use the GUI to do the installation, or you can script the installation of msbuild:

vs_buildtools.exe --add Microsoft.VisualStudio.Workload.MSBuildTools --quiet

@rainersigwald
Copy link
Member

@avikenjale As of today, that won't work to build this type of project--see #1697 for details.

@avikenjale
Copy link
Author

avikenjale commented Jun 6, 2017

@rainersigwald , so what is workaround for this? I need to get it done as need to provide WebAPI for testing.

Let me know if any changes need to be done either at project level or build server level.

@avikenjale avikenjale changed the title The default XML namespace of the project must be the MSBuild XML namespace MSB4019: The imported project "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Sdks\Microsoft.NET.Sdk.Web\Sdk\Sdk.props" was not found Jun 6, 2017
@avikenjale
Copy link
Author

@ravipal, any idea?

@rainersigwald
Copy link
Member

@avikenjale Install Visual Studio 2017 (not Build Tools but the full VS) on your build server.

@avikenjale
Copy link
Author

avikenjale commented Jun 6, 2017

@rainersigwald , you mean just installing msbuild tool 15.0 will not work? this is strange? then for my information, what is the purpose of msbuild 15.0 to install on build server? I mean, for which type of projects (.NET/ .NET Core) this - msbuild 15.0 will support?

@rainersigwald
Copy link
Member

@avikenjale Correct. This is discussed in detail in the bug I linked you to #1697, and the right place to ask further clarifying questions is there.

@AR-May AR-May added the triaged label Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants