我要将脚本转换为工程。在脚本中,我用 #I 设置引用的.dlls 路径。是否有办法直接在.fsproj 文件中指定此路径?
谢谢 谢谢
我要将脚本转换为工程。在脚本中,我用 #I 设置引用的.dlls 路径。是否有办法直接在.fsproj 文件中指定此路径?
谢谢 谢谢
fsproj
文件实际上是一个“https://learn.microsoft.com/ en-us/visualstudio/msbuilding/msbuilding-concepts?view=vs-2022" rel=“nofollow norefererr”>MS building 脚本,所以您可以使用标准的 MS 构建特性来定义变量( 如您的包含路径), 并在工程文件中使用它们。 这不像 F# 脚本文件中使用
例如,您可以创建一个文件 Includes.proj
, 定义您包含的路径 :
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<IncludePath>C:MyIncludePath</IncludePath>
</PropertyGroup>
</Project>
然后您可以修改 fsproj
文件以引用上述文件,并在您的引用中使用 $( IncludePath)
。 不幸的是,这必须在文本编辑器中完成( 即卸载工程, 修改工程, 然后重新装入它 ) :
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="Includes.proj" />
<!-- lots of other stuff -->
<ItemGroup>
<Reference Include="mscorlib" />
<Reference Include="System" />
<Reference Include="FSharp.Core" />
<Reference Include="MyAssembly">
<HintPath>$(IncludePath)MyAssembly.dll</HintPath>
</Reference>
</ItemGroup>
<!-- lots of other stuff -->
</Project>
您可以在 项目属性
- & gt; Reference paths
-> Add 文件夹
中设置引用文件夹。
如果您想要从程序上做到这一点, 请在 lt; project> < proget> PropertyGroup> & lt;...
下设置参考路径, 并在 lt; project>< < reference> hintPath>...
下设置参考路径。 这是 < a href=" https://gist. github.com/20062683" rel=“ noreferr” > a priter 做反向( 从 fsproj 到 fsx 文件), 但它可以给您一些要继续的提示 。
I have a number of events that happen in a game. I want to control the time and order at which these events occur. For example: Event 1: Show some text on screen for N frames & play a sound ...
Is there an easy way to create Silverlight 3 applications with F# (October CTP)? I have seen the F# for Silverlight, but that only works with the May CTP. I am using Visual Studio Integrated Shell ...
In F# I want to transform a list of chars into a string. Consider the following code: let lChars = [ a ; b ; c ] If I simply do lChars.ToString, I get "[ a ; b ; c ]". I m trying to get "abc". I ...
I m reading a file(a flash swf) from .Net 3.5 that has a header which states whether the body of the file/Stream is compressed or not. However, I m having problems-after I rewrap the basic File ...
Let s say I have a binary tree data structure defined as follows type a tree = | Node of a tree * a * a tree | Nil I have an instance of a tree as follows: let x = Node (Node (...
(Background: I ve been thinking about doing a presentation on F# and functional programming. From experience, I think that the wow factor of pattern matching and type inference is not necessarily ...
I recently began to read some F# related literature, speaking of "Real World Functional Programming" and "Expert F#" e. g.. At the beginning it s easy, because I have some background in Haskell, and ...
As part of a project I have assigned myself as a way of improving my knowledge of F# and functional programming in general, I am attempting to write a string pattern-matching algorithm from scratch ...