MSBuild not finding the DLL



我发布了一个带有Mono.Cecil的控制台应用程序,我想将MSBuild集成到构建过程中。但是,当我在自定义项目文件上运行dotnet build时,MSBuild会抛出一个错误,称为Expected file "objDebugnet5.0refinttest.dll" does not exist。它正在尝试在refint文件夹中查找生成的程序集。当程序集在objDebugnet5.0test.dll内部生成时。有没有办法更改MSBuild查找输出程序集的路径?IL生成器方面的一切都正常工作,我甚至在build文件夹中得到了一个可运行的exe。这是我的项目文件:

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<OutputType>Exe</OutputType>
<DefaultLanguageSourceExtension>.ao</DefaultLanguageSourceExtension>
<OutputPath>C:UsersfilipsourcealtosamplestestobjDebugnet5.0</OutputPath>
</PropertyGroup>
<Target Name="CreateManifestResourceNames" />
<Target Name="CoreCompile" DependsOnTargets="$(CoreCompileDependsOn)">
<Exec Command="dotnet run --project &quot;$(MSBuildThisFileDirectory)....srcaocaoc.csproj&quot; -- @(Compile->'$(MSBuildThisFileDirectory)', ' ') /o &quot;@(IntermediateAssembly)&quot; @(ReferencePath->' /r &quot;%(Identity)&quot;', ' ')"
WorkingDirectory="$(MSBuildProjectDirectory)" />
</Target>
</Project>

提前谢谢。

我没有阅读整个错误消息。

C:Program Filesdotnetsdk6.0.100-preview.7.21379.14Microsoft.Common.CurrentVersion.targets(4527,5): error : Expected file "objDebugnet5.0refinttest.dll" does not exist.

它实际上把我指向了一个抛出错误的文件。这就是:

<!-- Copy the reference assembly build product (.dll or .exe). -->
<CopyRefAssembly
SourcePath="@(IntermediateRefAssembly)"
DestinationPath="$(TargetRefPath)"
Condition="'$(ProduceReferenceAssembly)' == 'true' and '$(CopyBuildOutputToOutputDirectory)' == 'true' and '$(SkipCopyBuildProduct)' != 'true'"
>
<Output TaskParameter="DestinationPath" ItemName="ReferenceAssembly"/>
<Output TaskParameter="DestinationPath" ItemName="FileWrites"/>
</CopyRefAssembly>

它试图在我不需要的时候制作一个引用程序集。所以我只将ProduceReferenceAssembly属性设置为false,因为我不需要它。

相关内容

最新更新