4
Vote

Remove FixPackateManifestTask

description

When building any solution with VS 2012 and SharePoint 2013 (German Version) I get the following errors:

Fehler 1 Unerwarteter Fehler bei der FixPackageManifestTask-Aufgabe.
System.ArgumentException: Das Objekt mit dem Typ "Microsoft.Build.Execution.ProjectItemInstance+TaskItem" kann nicht in den Typ "Microsoft.Build.Framework.ITaskItem" konvertiert werden.
bei System.RuntimeType.TryChangeType(Object value, Binder binder, CultureInfo culture, Boolean needsSpecialCast)
bei System.RuntimeType.CheckValue(Object value, Binder binder, CultureInfo culture, BindingFlags invokeAttr)
bei System.Reflection.MethodBase.CheckArguments(Object[] parameters, Binder binder, BindingFlags invokeAttr, CultureInfo culture, Signature sig)
bei System.Reflection.RuntimeMethodInfo.InvokeArgumentsCheck(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
bei System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
bei System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture)
bei System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, Object[] index)
bei Microsoft.Build.Execution.TaskFactoryWrapper.SetPropertyValue(ITask task, TaskPropertyInfo property, Object value)
bei Microsoft.Build.BackEnd.TaskExecutionHost.InternalSetTaskParameter(TaskPropertyInfo parameter, Object parameterValue) Components

and

Der Manifest=$(LayoutPath)%(EnumeratedFiles.Package)\manifest.xml-Parameter für die FixPackageManifestTask-Aufgabe ist ungültig. Components

and

Die FixPackageManifestTask-Aufgabe konnte nicht mit den Eingabeparametern initialisiert werden. Components

Thank you for your help.

Kind regards

mike

file attachments

comments

Der_Shmoo wrote May 27, 2014 at 4:46 PM

If i install VS 2013 i got the same issue in vs 2010. Cant build any Project anymore.
If i uninstall vs 2013 ist working again.

this is a really annoying issue cause i Need vs2010 for the SharePoint Projects and vs 1013 for webprojects.

anyone have any idea how to fix this?

matein78 wrote May 28, 2014 at 11:59 AM

The FixPackageManifest task is not required anymore in SP2013 projects.

Open SPSF.targets in the "ApplicationConfiguration" solution folder and remove
  <!-- The following section contains a fix for a known problem with CAS policies in Visual Studio SharePoint Tools. See http://support.microsoft.com/kb/2022463 for more information -->
  <UsingTask TaskName="FixPackageManifestTask" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
    <ParameterGroup>
      <Manifest ParameterType="Microsoft.Build.Framework.ITaskItem" Required="true" />
    </ParameterGroup>
    <Task>
      <Reference Include="System.Xml" />
      <Reference Include="System.Xml.Linq" />
      <Using Namespace="System.IO" />
      <Using Namespace="System.Xml.Linq" />
      <Code Type="Fragment" Language="cs"><![CDATA[

      string fullPath = Manifest.GetMetadata("FullPath");
      if (File.Exists(fullPath))
      {
        var doc = XDocument.Load(fullPath);
        var ns = XNamespace.Get("http://schemas.microsoft.com/sharepoint/");
        var permissionSetElements = doc.Descendants(ns + "PermissionSet");
        foreach (var permissionSetElement in permissionSetElements)
        {
          permissionSetElement.SetAttributeValue("class", null);
        }
        doc.Save(fullPath);
      }

      ]]></Code>
    </Task>
  </UsingTask>
and
  <Target Name="FixPackageManifest">
    <Message Text="SPSF: Applying fix for CAS policies" Importance="high" />
    <FixPackageManifestTask Manifest="$(LayoutPath)%(EnumeratedFiles.Package)\manifest.xml" />
  </Target>
Close and reopen the Visual Studio Solution and it should work.

Der_Shmoo wrote May 28, 2014 at 12:19 PM

Thanks for Your quick Respons.
The FixPackageManifest task is not required anymore in SP2013 projects.
Ok, but the Problem is in SharePoint 2010 Project on VS 2010.
If VS 2013 is just installed on the PC, i get this error in any SharePoint 2010 Project i open with VS 2010.

If i uninstall VS2013 it works again.

avishnyakov wrote Jun 23, 2014 at 1:54 AM

Having same issues for VS2012. Project cannot be compiled at all.
Should it be removed?

avishnyakov wrote Jun 23, 2014 at 1:54 AM

OMG - IMPACT:Low, really?

GromPlex wrote Aug 14, 2014 at 1:02 PM

Hello,

I faced the same issue and was able to solve it.
Just in case, I'm sharing the solution here.

The solution is to configure specific assembly binding redirects in Visual Studio config file to avoid MsBuild version mismatch.
Simply add the following segment in Visual Studio 2010 DevEnv.exe.config file:
    <!-- Added to fix MSBuild assembly compatibility issues when Visual Studio 2010 and Visual Studio 2013 are installed side-by-side -->
    <dependentAssembly>
        <assemblyIdentity name="Microsoft.Build.Framework" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
        <bindingRedirect oldVersion="2.0.0.0-3.0.0.0" newVersion="4.0.0.0"/>
        <bindingRedirect oldVersion="12.0.0.0" newVersion="4.0.0.0"/>
    </dependentAssembly>
    <dependentAssembly>
        <assemblyIdentity name="Microsoft.Build" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
        <bindingRedirect oldVersion="2.0.0.0-3.0.0.0" newVersion="4.0.0.0"/>
        <bindingRedirect oldVersion="12.0.0.0" newVersion="4.0.0.0"/>
    </dependentAssembly>
    <dependentAssembly>
        <assemblyIdentity name="Microsoft.Build.Engine" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
        <bindingRedirect oldVersion="2.0.0.0-3.0.0.0" newVersion="4.0.0.0"/>
        <bindingRedirect oldVersion="12.0.0.0" newVersion="4.0.0.0"/>
    </dependentAssembly>
    <!-- Added to fix MSBuild assembly compatibility issues when Visual Studio 2010 and Visual Studio 2013 are installed side-by-side -->
Source here: https://connect.microsoft.com/VisualStudio/feedback/details/900814/installing-vs-2013-update-2-with-ssdt-breaks-vs-2012-ssdt-functionality

Hope it helps someone!

Jérôme

matein78 wrote Aug 26, 2014 at 9:35 AM

Sorry guys for all the trouble, but time does not allow to update the project right now, as it is rather complex to maintain.
The entire current source code is available at https://github.com/rencoreab/SharePoint-Software-Factory
So please contribute fixes and I will put them into a new release asap.

Thanks for your understanding!