繁体   English   中英

没有为此项目设置Outputpath属性 - F#

[英]The Outputpath property is not set for this project - F#

当我在Visual Studio 2012下创建一个新的F#应用程序并构建它时,会发生同样的错误:

错误1未为项目'TestingF.fsproj'设置OutputPath属性。 请检查以确保您为此项目指定了有效的配置和平台组合。 Configuration ='Debug'Blatter =''。 如果某个其他项目正在尝试遵循项目到项目对此项目的引用,此项目已卸载或未包含在解决方案中,并且引用项目不使用相同或等效项目构建,则也可能出现此错误配置或平台。 C:\\ Windows \\ Microsoft.NET \\ Framework \\ v4.0.30319 \\ Microsoft.Common.targets 592 5 TestingF

尝试使用Configuration Manager修改Configuration | Platform并卸载项目并编辑.fsproj文件。

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<Tailcalls>false</Tailcalls>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<WarningLevel>3</WarningLevel>
<PlatformTarget>AnyCPU</PlatformTarget>
<DocumentationFile>bin\Debug\TestingF.XML</DocumentationFile>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>

使用任何其他.Net语言都不会发生同样的错误。

万一其他人遇到这个问题,这里是如何解决它

问题类似于Gustavo在上一个答案中解决的问题,但对于F#项目 ,似乎还有另外一个问题需要解决。
我在VS2013 Update 2中遇到过这个问题。 编辑平台设置后 ,在Configuration Manager中添加x64平台时出现问题。

该问题与.fsproj文件中某些XML标记顺序有关 请参阅下面的正确.fsproj文件。

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" ...>
  <Import Project=.../>
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    ...
    <RestorePackages>true</RestorePackages>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    ...
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <Tailcalls>true</Tailcalls>
    ...
  </PropertyGroup>
  <PropertyGroup>
    <MinimumVisualStudioVersion Condition="'$(MinimumVisualStudioVersion)' == ''">11</MinimumVisualStudioVersion>
  </PropertyGroup>

发生的情况是,有时,在Configuration Manager中编辑配置后,配置平台的一个或多个PropertyGroup标记( Debug | x64或Release | x64 )已在文件中向下移动

因此,只需编辑fsproj文件并向上移动这些标记即可。 例如,将它们移动到定义MinimumVisualStudioVersion的组之前,如示例中所示。 保存,重新加载项目并编译。

看一下错误:

[...]确保您已为此项目指定了Configuration和Platform的有效组合。 Configuration ='Debug'Blatter =''。 此错误也可能出现[...]

Visual Studio正在尝试构建Platform ='',Configuration ='Debug'。 但是,您发布的项目文件指定了以下配置:

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    . . .
</PropertyGroup>

也就是说,它告诉Visual Studio如何构建'Debug'/'AnyCPU',而不是'Debug'/''。

如果您在其中插入“AnyCPU”,它应该会为您提供您正在寻找的结果。

可以在此处找到更详细的答案: https//stackoverflow.com/a/13372073/556595

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM