对于F#类型提供程序,如何使相对路径作为静态参数起作用? [英] For an F# Type Provider, how do I make a relative path work as a static parameter?

查看:89
本文介绍了对于F#类型提供程序,如何使相对路径作为静态参数起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种好的方法可以使编程时的类型提供程序和构建时的msbuild的相对路径都起作用?

Is there a good way to make a relative path work for both the type provider while programming and msbuild while building?

//type AddressBookProto = Froto.Gen.ProtoGen< @"test\addressbook1.proto"> // VS GUI
//type AddressBookProto = Froto.Gen.ProtoGen< @"..\test\addressbook1.proto"> // Build
type AddressBookProto = Froto.Gen.ProtoGen< @"C:\Users\taggartc\froto\froto\test\addressbook1.proto">

推荐答案

您可以使用#if

#if DEBUG //or similar constant
    type AddressBookProto = Froto.Gen.ProtoGen< @"test\addressbook1.proto">
#else
    type AddressBookProto = Froto.Gen.ProtoGen< @"..\test\addressbook1.proto">
#endif

现在,您只需要定义适当的条件即可.

Now you just need to define appropriate conditionals.

这篇关于对于F#类型提供程序,如何使相对路径作为静态参数起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆