【问题标题】:.Net Standard 2.0 library with custom output and intermediate files path?具有自定义输出和中间文件路径的.Net Standard 2.0 库?
【发布时间】:2018-07-21 13:30:45
【问题描述】:

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

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

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

<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>

【问题讨论】:

    标签: .net visual-studio xamarin.forms


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2012-12-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多