我有一个非常讨厌的问题,我找到了解决方案,但我想问你为什么它的行为......
我正在使用Visual Studio 2012和TFS 2012.一切都很好,但有一天我发现了一个问题.当我在我的解决方案中添加了一个新项目时,每次重新打开解决方案时,我总是会收到此消息:
此项目文件...未绑定到源代码管理,但该解决方案包含其源代码控制绑定信息.你想要...
无论我做了什么,我仍然有这个信息.在File-> Source Control-> Advanced-> Change Source Control ...'窗口中,每件事情都很好.正确创建好内容的*.vspscc文件.我正在删除绑定并一次又一次地添加它,但它没有帮助.我一直有这个烦人的消息......
然后我发现了*.csproj文件中的一个区别.我有问题的项目没有以下XML数据:
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
Run Code Online (Sandbox Code Playgroud)
当我添加这些行时,问题就解决了......
有没有人可以告诉我为什么那些缺失的元素以及为什么它们会引发关于解决方案绑定的烦人消息的永无止境的问题?
谢谢
我有一个问题实际上已经解决了,但我完全不明白为什么它会像这样.
所以我有一个网络共享,我想简单地验证我是否有权在该共享中创建新文件和目录.我用了两种方法来解决这个问题,但两者都得到了不同的结果.我的测试用例是我无法在该共享上创建文件和目录:
try
{
var testPath = Path.Combine(path, testDirectory)
Directory.CreateDirectory(testPath)
}
catch
{
// No access
}
Run Code Online (Sandbox Code Playgroud)
这是一种我根本不喜欢的方式,但它有效...我在这里有一个例外,所以它正确地说我没有特定路径的权限.
try
{
var writePermission = new FileIOPermission(FileIOPermissionAccess.Write, path)
var appendPermission = new FileIOPermission(FileIOPermissionAccess.Append, path)
writePermission.Demand()
appendPermission.Demand()
}
catch
{
// No access
}
Run Code Online (Sandbox Code Playgroud)
通过这种方法,我没有任何异常,所以它告诉我,我有权创建新文件 - 实际上并非如此.
谁知道第二种方法有什么问题?
我有问题通过MSBuild构建我的解决方案.
在我的解决方案中,我有F#项目,我已经添加了AssemblyInfo.fs文件,这样的文件如下所示:
namespace namespaceName
open System.Reflection
open System.Runtime.CompilerServices
open System.Runtime.InteropServices
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[<assembly: AssemblyTitle("assemblyName")>]
[<assembly: AssemblyDescription("")>]
[<assembly: AssemblyConfiguration("")>]
[<assembly: AssemblyCompany("")>]
[<assembly: AssemblyProduct("assemblyName")>]
[<assembly: AssemblyCopyright("Copyright © 2013")>]
[<assembly: AssemblyTrademark("")>]
[<assembly: AssemblyCulture("")>]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type …Run Code Online (Sandbox Code Playgroud) 可能我有一个愚蠢的问题,但我无法让它发挥作用.我正在根据C#中的MSDN示例在F#中进行AES加密\解密:
http://msdn.microsoft.com/en-us/library/system.security.cryptography.aes.aspx
我的加密方法如下:
let EncryptStringToBytesAes (plainText : string) (key : byte[]) (iv : byte[]) =
use aesAlg = Aes.Create()
aesAlg.Key <- key
aesAlg.IV <- iv
// Create a decrytor to perform the stream transform.
let encryptor = aesAlg.CreateEncryptor(aesAlg.Key, aesAlg.IV)
// Create the streams used for encryption.
use msEncrypt = new MemoryStream()
use csEncrypt = new CryptoStream(msEncrypt, encryptor, CryptoStreamMode.Write)
use swEncrypt = new StreamWriter(csEncrypt)
swEncrypt.Write(plainText)
msEncrypt.ToArray()
Run Code Online (Sandbox Code Playgroud)
问题是这个方法总是返回一个空的字节数组.我没有任何例外.密钥和IV是适当的字节数组.好像StreamWriter不工作......
谢谢你的帮助.
我有一系列需要过滤的数据.这很明显,因为我们Seq.filter有价值.但是,我的问题是我需要过滤,直到最终的集合将达到一定数量的项目.我不想对所有项目执行过滤而不是截断,我想在不再需要它的时候停止过滤.
在命令式编程中,基本上这是一项非常简单的任务 - 我可以在F#中轻松完成,就像在C#中完成一样,但我想在功能风格上做到这一点.
我已经看了一下该Collections.Seq模块,但我没有发现任何可以帮助我的东西.事实上我需要类似的东西filterWhile.有任何想法吗?
谢谢你的帮助.
我有一个愚蠢的问题,我需要在F#类中实现具有以下方法的接口:
public interface IMyInterface
{
T MyMethod<T>() where T : class;
}
Run Code Online (Sandbox Code Playgroud)
我在F#中努力做到这一点.我尝试过不同的方法.但问题是必须返回类型为T的对象.Null不被接受:
type public Implementation() =
interface IMyInterface with
member this.MyMethod<'T when 'T : not struct>() = null
Run Code Online (Sandbox Code Playgroud)
错误:成员'MyMethod <'T当'T:not struct>:unit - > a'when a':not struct和'a:null没有正确的类型来覆盖相应的抽象方法.'T:not struct>时所需的签名是'MyMethod <'T:单位 - >'T时'T:not struct'
所以我试图将T作为参数添加到类中,但仍然没有完成错误:
type public Implementation(data : 'T when 'T : not struct) =
interface IMyInterface with
member this.MyMethod<'T when 'T : not struct>() = data
Run Code Online (Sandbox Code Playgroud)
错误:成员'MyMethod <'T当'T:not struct>:unit - >'T时'T:not struct'没有正确的类型来覆盖相应的抽象方法.
谢谢你的帮助.
f# ×4
.net ×2
aes ×1
assemblyinfo ×1
c# ×1
cryptography ×1
csproj ×1
encryption ×1
filter ×1
fsc ×1
interface ×1
msbuild ×1
seq ×1
tfs2012 ×1