简体   繁体   English

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

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

When I create a new F# Application under Visual Studio 2012 and build it, the same error occur: 当我在Visual Studio 2012下创建一个新的F#应用程序并构建它时,会发生同样的错误:

Error 1 The OutputPath property is not set for project 'TestingF.fsproj'. 错误1未为项目'TestingF.fsproj'设置OutputPath属性。 Pleasecheck to make sure that you have specified a valid combination of Configuration and Platform for this project. 请检查以确保您为此项目指定了有效的配置和平台组合。 Configuration='Debug' Platform=''. Configuration ='Debug'Blatter =''。 This error may also appear if some other project is trying to follow a project-to-project reference to this project, this project has been unloaded or is not included in the solution, and the referencing project does not build using the same or an equivalent Configuration or Platform. 如果某个其他项目正在尝试遵循项目到项目对此项目的引用,此项目已卸载或未包含在解决方案中,并且引用项目不使用相同或等效项目构建,则也可能出现此错误配置或平台。 C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\Microsoft.Common.targets 592 5 TestingF C:\\ Windows \\ Microsoft.NET \\ Framework \\ v4.0.30319 \\ Microsoft.Common.targets 592 5 TestingF

Tried to modify the Configuration|Platform using Configuration Manager and also unload the project and edit the .fsproj file. 尝试使用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>

The same error never occurred using any other .Net Language. 使用任何其他.Net语言都不会发生同样的错误。

Just in case someone else experiences this problem, here's how to fix it . 万一其他人遇到这个问题,这里是如何解决它

The issue is similar to the one solved by Gustavo in the previous answer, but for F# projects it seems that there is another additional issue you have to workaround. 问题类似于Gustavo在上一个答案中解决的问题,但对于F#项目 ,似乎还有另外一个问题需要解决。
I've had this problem in VS2013 Update 2 . 我在VS2013 Update 2中遇到过这个问题。 The problem appeared after editing the Platform settings , adding a x64 platform in Configuration Manager . 编辑平台设置后 ,在Configuration Manager中添加x64平台时出现问题。

The problem is related to the order of some of the XML tags in the .fsproj file . 该问题与.fsproj文件中某些XML标记顺序有关 See below a correct .fsproj file. 请参阅下面的正确.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>

What happens is that sometimes, after editing the configurations in Configuration Manager, one or more of the PropertyGroup tags that configure the platform ( Debug|x64 or Release|x64 ) have been moved downwards in the file. 发生的情况是,有时,在Configuration Manager中编辑配置后,配置平台的一个或多个PropertyGroup标记( Debug | x64或Release | x64 )已在文件中向下移动

So, just edit the fsproj file and move these tags upwards. 因此,只需编辑fsproj文件并向上移动这些标记即可。 For example, move them to just before the group that defines the MinimumVisualStudioVersion , as in the example. 例如,将它们移动到定义MinimumVisualStudioVersion的组之前,如示例中所示。 Save, reload the project and compile. 保存,重新加载项目并编译。

Take a look at the error: 看一下错误:

[...] make sure that you have specified a valid combination of Configuration and Platform for this project. [...]确保您已为此项目指定了Configuration和Platform的有效组合。 Configuration='Debug' Platform=''. Configuration ='Debug'Blatter =''。 This error may also appear [...] 此错误也可能出现[...]

Visual Studio is trying to build Platform='', Configuration='Debug'. Visual Studio正在尝试构建Platform ='',Configuration ='Debug'。 The project file you posted, however, specifies the following configuration: 但是,您发布的项目文件指定了以下配置:

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

That is, it tells Visual Studio how to build 'Debug'/'AnyCPU', but not 'Debug'/' '. 也就是说,它告诉Visual Studio如何构建'Debug'/'AnyCPU',而不是'Debug'/''。

If you insert 'AnyCPU' in there, it should give you the results you're looking for. 如果您在其中插入“AnyCPU”,它应该会为您提供您正在寻找的结果。

A more elaborate answer can be found here: https://stackoverflow.com/a/13372073/556595 可以在此处找到更详细的答案: https//stackoverflow.com/a/13372073/556595

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

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