.Net Standard 2.0库带有自定义输出和中间文件路径?

时间:2018-02-11 05:17:44

标签: .net visual-studio xamarin.forms

在.Net Standard 2.0库项目中,直接为输出和中间文件指定自定义路径的正确方法是什么?

我尝试了以下配置,该版本适用于.Net标准库的previos版本。

请注意那些路径是相对于项目的,我只是复制了在升级到.Net Standard 2.0之前工作的相同路径,除了我从IDE设置窗口放入的任何内容在保存到.csproj时转换为相对路径文件。

enter image description here

<PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
    <EnableDefaultEmbeddedResourceItems Condition=" '$(EnableDefaultEmbeddedResourceItems)' == '' ">false</EnableDefaultEmbeddedResourceItems>
    <ProjectName Condition=" '$(ProjectName)' == '' ">MyLibrary</ProjectName>
    <SolutionOutputPath Condition=" '$(SolutionOutputPath)' == '' ">..\..\..\..\..\..\tmp\com.company.myapp</SolutionOutputPath>
    <BaseIntermediateOutputPath>..\..\..\..\..\..\tmp\com.company.myapp\MyLibrary\obj\Debug</BaseIntermediateOutputPath>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <Optimize>false</Optimize>
    <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
    <OutputPath>$(SolutionOutputPath)\$(ProjectName)\bin\$(Configuration)</OutputPath>
    <BaseOutputPath>$(SolutionOutputPath)\$(ProjectName)\bin\$(Configuration)</BaseOutputPath>
    <IntermediateOutputPath>$(SolutionOutputPath)\$(ProjectName)\obj\$(Configuration)</IntermediateOutputPath>
    <BaseIntermediateOutputPath>$(SolutionOutputPath)\$(ProjectName)\obj\$(Configuration)</BaseIntermediateOutputPath>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType></DebugType>
    <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
    <OutputPath>$(SolutionOutputPath)\$(ProjectName)\bin\$(Configuration)</OutputPath>
    <BaseOutputPath>$(SolutionOutputPath)\$(ProjectName)\bin\$(Configuration)</BaseOutputPath>
    <IntermediateOutputPath>$(SolutionOutputPath)\$(ProjectName)\obj\$(Configuration)</IntermediateOutputPath>
    <BaseIntermediateOutputPath>$(SolutionOutputPath)\$(ProjectName)\obj\$(Configuration)</BaseIntermediateOutputPath>
</PropertyGroup>

1 个答案:

答案 0 :(得分:0)

.NET Standard在后台使用msbuild。因此,您可以使用之前使用的相同属性:OutputPath和IntermediateOutputPath。