2
votes

I have a simple SharePoint 2013 solution which I can publish through Visual Studio - this will generate .wsp for me. However when I am trying to run build by the command:

msbuild /t:Package mySolution.sln

Build is ok but during packaging I receive an error:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\VisualStudio\v15.0\SharePointTools\Microsoft.VisualStudio.SharePoint.targets(190,5): error : Could not load file or assembly 'Microsoft.VisualStudio.Modeling.Sdk.15.0, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

If I put this missing dll to C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\VisualStudio\v15.0\SharePointTools then I receive another error about another missing dll... What am I doing wrong?

1
The same error here:developercommunity.visualstudio.com/content/problem/28775/…. Visual Studio team has determined that this issue is related to the SharePoint/Modeling SDK. So we suggest you can follow up with SharePoint/Modeling SDK teams' forum.Leo Liu-MSFT
I have the same issue and asked a question on their forums: social.msdn.microsoft.com/Forums/office/en-US/… (hopefully this was the right one)Robert Muehsig

1 Answers

1
votes

Looks like this is MSBuild issue: 1.Open elevated command prompt

2.Navigate to your SDK tools

cd "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\x64"

  1. Sn -Vr "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\PrivateAssemblies\Microsoft.VisualStudio.Modeling.Sdk.15.0.dll"

  2. gacutil /i "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\PrivateAssemblies\Microsoft.VisualStudio.Modeling.Sdk.15.0.dll"

  3. For the following three dlls, please do same behavior from step 3 to 4

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.SharePoint.dll

Note if Microsoft.VisualStudio.SharePoint.dll not found in above path, check in
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\VisualStudio\v15.0\SharePointTools\Microsoft.VisualStudio.SharePoint.dll

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\PrivateAssemblies\Microsoft.VisualStudio.SharePoint.Designers.Models.dll C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\PrivateAssemblies\Microsoft.VisualStudio.SharePoint.Designers.Models.Features.dll

  1. Now you can MSBuild your SharePoint 2016 solutions by VS command promp.

Check Link, that's for Sharepoint 2016, but same works for 2013 as well: https://developercommunity.visualstudio.com/content/problem/40195/cant-use-msbuild-to-package-sharepoint-2016-soluti.html