【发布时间】:2021-11-11 20:01:50
【问题描述】:
我使用Mono.Cecil 发出一个控制台应用程序,并且我想将 MSBuild 集成到构建过程中。但是当我在我的自定义项目文件上运行dotnet build 时,MSBuild 会抛出一个错误说Expected file "obj\Debug\net5.0\refint\test.dll" does not exist。它试图在refint 文件夹中找到生成的程序集。当程序集在obj\Debug\net5.0\test.dll 内生成时,它应该是。有没有办法可以更改 MSBuild 查找输出程序集的路径? IL 生成器方面的所有内容都可以正常工作,我什至在 build 文件夹中获得了一个可运行的 exe。这是我的项目文件:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<OutputType>Exe</OutputType>
<DefaultLanguageSourceExtension>.ao</DefaultLanguageSourceExtension>
<OutputPath>C:\Users\filip\source\alto\samples\test\obj\Debug\net5.0\</OutputPath>
</PropertyGroup>
<Target Name="CreateManifestResourceNames" />
<Target Name="CoreCompile" DependsOnTargets="$(CoreCompileDependsOn)">
<Exec Command="dotnet run --project "$(MSBuildThisFileDirectory)\..\..\src\aoc\aoc.csproj" -- @(Compile->'$(MSBuildThisFileDirectory)', ' ') /o "@(IntermediateAssembly)" @(ReferencePath->' /r "%(Identity)"', ' ')"
WorkingDirectory="$(MSBuildProjectDirectory)" />
</Target>
</Project>
提前谢谢你。
【问题讨论】:
-
IntermediateOutputPath包含输出文件夹的路径,例如`obj\debug\net5.0`。您应该更新此属性 -
IntermediateOutputPath不是问题所在。它被设置为正确的路径。我想出了一个解决方案。
标签: msbuild