小编Pau*_*etz的帖子

从Visual Studio文本选择中获取Roslyn SyntaxToken(插入位置)

我试图在Visual Studio扩展包中的VSSDK和Roslyn SDK之间架起桥梁,并且一直很难用.Visual Studio提供的ActivePoint.AbsoluteCharOffset与使用FindToken(offset)时从Roslyn获取的元素不匹配.我很确定这与我的当前工作黑客的每一方如何计算EOL字符有关,但我不是100%,我的黑客将长期坚持.

我的黑客就是这条线: charOffset += point.Line;

我在char偏移量上添加行数,这似乎有效,所以我猜我正在添加所有被activepoint计数忽略的换行符.

助手

private VisualStudioWorkspace workspace = null;
public RoslynUtilities(VisualStudioWorkspace workspace)
{
    this.workspace = workspace;
}
public Solution Solution { get { return workspace.CurrentSolution; } }
public Document GetDocumentFromPath(string fullPath)
{
    foreach (Project proj in this.Solution.Projects)
    {               
        foreach (Document doc in proj.Documents)
        {
            if (doc.FilePath == fullPath)
                return doc;                   
        }
    }
    return null;
}
public SyntaxTree GetSyntaxTreeFromDocumentPath(string fullPath)
{
    Document doc = GetDocumentFromPath(fullPath);
    if (doc != null)
        return doc.GetSyntaxTreeAsync().Result;
    else
        return null;
} …
Run Code Online (Sandbox Code Playgroud)

c# visual-studio visual-studio-extensions roslyn visual-studio-2015

5
推荐指数
1
解决办法
969
查看次数

TFS 2015 U1 vNext build发布工件始终失败,无法将工件与资源相关联

在尝试使用Publish Artifact任务执行任何vNext构建时,我们最终得到以下错误

##[error]Unable to associate artifact with resource at location:[location]
Run Code Online (Sandbox Code Playgroud)

示例日志输出

1 
2016-01-21T19:29:49.9838278Z Executing the powershell script: D:\Agent\tasks\PublishBuildArtifacts\1.0.4\PublishBuildArtifacts.ps1

2 
2016-01-21T19:29:50.1713333Z Preparing artifact content in staging folder D:\Agent\_work\1\a...

3 
2016-01-21T19:29:50.2338323Z Copying all files from D:\Agent\_work\1\s\ASC\ASC-Dev\CSDChangeControlDispatcher to D:\Agent\_work\1\a\CSDChangeControlDispatcher\CSDChangeControlDispatcher

4 
2016-01-21T19:29:50.4838343Z Copying all files from D:\Agent\_work\1\s\ASC\ASC-Dev\PrecompiledWeb\CSDChangeControlDispatcher to D:\Agent\_work\1\a\CSDChangeControlDispatcher\PrecompiledWeb\CSDChangeControlDispatcher

5 
2016-01-21T19:29:50.5150903Z Copying artifact content to D:\BuildDrop\ASC Dev vNext\20160121.7...

6 
2016-01-21T19:29:50.9369728Z Start: AssociateArtifact

7 
2016-01-21T19:29:50.9369728Z ##[error]Unable to associate artifact with resource at location:D:\BuildDrop\ASC Dev vNext\20160121.7.

8 
2016-01-21T19:29:50.9369728Z End: AssociateArtifact
Run Code Online (Sandbox Code Playgroud)

tfs tfs-2015

4
推荐指数
1
解决办法
3043
查看次数