Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
MSbuild 4.0无法编译.Net 3.5项目_Msbuild_Compiler Errors_Msbuild 4.0 - Fatal编程技术网

MSbuild 4.0无法编译.Net 3.5项目

MSbuild 4.0无法编译.Net 3.5项目,msbuild,compiler-errors,msbuild-4.0,Msbuild,Compiler Errors,Msbuild 4.0,我正在使用Msbuild 4.0 在我们的项目中,很少有解决方案有.NET3.5项目 当我通过visualstudio编译它时,它就工作了。如果使用Msbuild生成相同的代码,则会失败 以下为汇编问题: 错误:编译失败。无法加载一个或多个请求的类型。有关详细信息,请检索LoaderExceptions属性。 来自HRESULT的异常:0x8013155 甚至我也试着换衣服 工具版本3.5 通过项目的附加属性。[我正在使用Msbuild任务生成解决方案] 我们的Msbuild任务如下所示 <

我正在使用Msbuild 4.0

在我们的项目中,很少有解决方案有.NET3.5项目

当我通过visualstudio编译它时,它就工作了。如果使用Msbuild生成相同的代码,则会失败

以下为汇编问题:

错误:编译失败。无法加载一个或多个请求的类型。有关详细信息,请检索LoaderExceptions属性。 来自HRESULT的异常:0x8013155

甚至我也试着换衣服

工具版本3.5

通过项目的附加属性。[我正在使用Msbuild任务生成解决方案]

我们的Msbuild任务如下所示

<Target Name="BuildDotNETSolutions" Condition="'$(Group)' != ''" DependsOnTargets="Init;GetNextVersionNumber">
    <!-- Complie solutions -->
    <!-- Version property is useful for changing the Wix Msi version-->
    <MSBuild Projects="@(Solution)" BuildInParallel="true"
                 Properties="Configuration=$(Configuration);PostbuildEvent=;Version=$(BuildNextVersionNumber)"
                 Condition="'%(Solution.Group)' == '$(Group)' And '%(Solution.Type)' == 'DotNET' And '%(Solution.IsRebuild)'=='$(IsRebuild)'">

      <Output
                      TaskParameter="TargetOutputs"
                      ItemName="BuildOutputs" />
    </MSBuild>

我们正在通过属性文件传递解决方案,如下所示

<Solution Include="$(Implementation)\MultiEvent.csproj;">
      <Group>Event</Group>
      <AdditionalProperties>
        ReferencePath=$(Implementation)\References;
        ToolsVersion=3.5;
      </AdditionalProperties>
      <IsRebuild>True</IsRebuild>
      <Type>DotNET</Type>
    </Solution>

事件
ReferencePath=$(实现)\References;
工具版本=3.5;
真的
网络

我不知道您是否有运行MSBuild的脚本运行程序。就我个人而言,我正在使用NAnt,一切正常。我(在某处)读到,MSBuild有时会做一些愚蠢的事情,通过添加属性“TrackFileAccess”并将其设置为“false”会有很大帮助。就我而言,它解决了这个问题

如果有什么帮助的话,我已经包括了我的NAnt构建任务。我希望它能对你有用

<!--*******************************************************************************
Runs MSBuild to build the project solution

Arguments:
${MSBuild.exe}:  Path to MSBuild.exe
${project.solution}: the solution name to build
${buildconfiguration}: The build configuration to trigger the build
${build.dir} : The directory where to put builded files

********************************************************************************-->
<target name="run.msbuild" description="Rebuilds a given solution file">

<echo message="Rebuilding Solution ${project.solution}" />
<echo>${MSBuild.exe}</echo>

<exec program="${MSBuild.exe}">
       <arg value="${project.solution}"/>
    <arg line="/property:SignAssembly=${project.sign},AssemblyOriginatorKeyFile=${project::get-base-directory()}\${project.signature.file}" />
    <arg line="/property:OutDir=${build.dir}" />
    <arg line="/property:TrackFileAccess=false" />
    <arg line="/property:DebugType=${debug.type}" />
    <arg line="/property:Platform=&quot;Any CPU&quot;" />
    <arg line="/nologo" />
    <arg line="/verbosity:minimal" />
    <arg line="/property:Configuration=${buildconfiguration}"/>
</exec>

${MSBuild.exe}

对于开发构建,我设置了以下参数:

<property name="buildconfiguration" value="Debug"/>
<property name="debug.type" value="full" />


给我们一个msbuild代码和命令的示例将有助于找到解决方案。@James Woolfenden:我已经更新了代码和命令