我在VS2008中构建了一个组件项目,目标是.NET Framework 3.5.我最近下载了VS2010 Beta 1,以确保在切换到新IDE时该项目能够正确转换.该项目包含对框架版本2.0构建的几个第三方dll的引用.我改变了我的项目以构建框架的4.0版本但是当我尝试构建项目时,我得到了大量错误,看起来编译器无法识别类似于下面的第三方库的类类型.
"命名空间'Microsoft.Practices.EnterpriseLibrary'中不存在类型或命名空间名称'Data'(您是否缺少程序集引用?)"
我想弄清楚为什么我无法编译.从我读到的内容来看,.NET 4.0使用了不同版本的CLR.如何或为何会影响我访问这些类型的能力?我是否必须这样做
a)获取源代码并在VS2010/.NET 4.0中重新编译,然后引用该程序集或
b)等待项目作者在上面做"a"并发布针对4.0 CLR的程序集?要么
c)还有别的因为我的VS2010安装可能会被堵塞吗?
我可以将项目属性更改为目标3.5,一切都按照我在2010 IDE中的预期运行.
我刚刚将一个功能分支重新设置到另一个功能分支上(准备将所有内容重新设置为我的主人),它涉及了一些棘手的合并解决方案.
rebase是否自动保存为某个提交位置?
那些修改在哪里生活?我在gitk中看不到任何东西,或者git log --oneline.
(同样的问题是我在重新定位后合并我的分支.)
我有一个非一次性类,我希望能够使用Open/Close语法use,所以我试图继承它,并将Open打开到newClose to Dispose.
第二部分没问题,但我无法解决如何进行Open:
type DisposableOpenCloseClass(openargs) =
inherit OpenCloseClass()
//do this.Open(openargs) <-- compiler no like
interface IDisposable
with member this.Dispose() = this.Close()
Run Code Online (Sandbox Code Playgroud)
(参考我很久以前问过的这个问题,但我不能加入这个问题)
这个问题结合了我不完全理解的两个主题
通过阅读有关F#中异步的文章,我遇到了Agent/MailboxProcessors的主题,它可用于实现反应状态机.是否可以使用C#5中的新异步/等待功能来实现C#中类似的功能,或者是否已经存在更适合的类似模拟?
$ git cherry-pick 5de83068
error: Your local changes to the following files would be overwritten by merge:
Components/ApplicationEnums/Application.cs
Please, commit your changes or stash them before you can merge.
Aborting
$ git status
# On branch master
nothing to commit (working directory clean)
更新对不起,我切换到另一个分支,并再次切换回来,不能重现这个:(
在调试模式下,如果按下F5开始调试时,如果我们的应用程序中出现错误,则会出现一个对话框,其中包含警告:"您的程序有错误.您要运行上次修改的程序吗?" 或类似的东西.
我想启用或禁用此对话框.
我怎样才能做到这一点?
我想尝试这个自托管Web服务的例子(最初用WCF WebApi编写),但是使用新的ASP.NET WebAPI(它是WCF WebApi的后代).
using System;
using System.Net.Http;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
using Microsoft.ApplicationServer.Http;
namespace SampleApi {
class Program {
static void Main(string[] args) {
var host = new HttpServiceHost(typeof (ApiService), "http://localhost:9000");
host.Open();
Console.WriteLine("Browse to http://localhost:9000");
Console.Read();
}
}
[ServiceContract]
public class ApiService {
[WebGet(UriTemplate = "")]
public HttpResponseMessage GetHome() {
return new HttpResponseMessage() {
Content = new StringContent("Welcome Home", Encoding.UTF8, "text/plain")
};
}
}
}
Run Code Online (Sandbox Code Playgroud)
但是,要么我没有NuGotten正确的包,要么HttpServiceHost是AWOL.(我选择了'自托管'变体).
我错过了什么?
我发现自己经常想用来Publish().RefCount()"保护我的来源".
例如,将一些传入的IObservable json转换为两个IObservable属性时:
var anon = source.Select(TranslateToAnonObject);
this.Xs = anon.Select(GetXFromAnonObject);
this.Ys = anon.Select(GetYFromAnonObject);
Run Code Online (Sandbox Code Playgroud)
为了避免两次执行翻译,我很想Publish().RefCount()在anon定义后面加上一个.
对于两个属性值也是如此,以避免Get..为每个订户单独执行功能.
问题是,它已经到了我无法真正看到许多我不想要的情况.但如果这是正确的,那肯定是Rx的默认值.我在想什么?
(想一想:是因为我几乎只与'热'观察者合作?)
目的是为我的自定义按钮模板构建图标路径几何的资源字典.
到目前为止有效:
ResourceDictionary中:
<Geometry x:Key="ArrowDown">
M0,10 M10,0 M5,1 L5,7 4.2,7 5,8 5.8,7 5,7
</Geometry>
<Geometry x:Key="ArrowUp">
M0,0 M10,10 M5,9 L5,3 4.2,3 5,2 5.8,3 5,3
</Geometry>
Run Code Online (Sandbox Code Playgroud)
路径的附属物:
public static Geometry GetIconPath(UIElement element)
{
return (Geometry)element.GetValue(IconPathProperty);
}
public static void SetIconPath(UIElement element, Geometry value)
{
element.SetValue(PIconPathProperty, value);
}
public static readonly DependencyProperty IconPathProperty =
DependencyProperty.RegisterAttached("IconPath", typeof(Geometry), typeof(Attached));
Run Code Online (Sandbox Code Playgroud)
模板:
<ControlTemplate x:Key="ButtonTemplate" TargetType="{x:Type Button}">
<Viewbox>
<Path Name="Icon" Stroke="Black" StrokeThickness="1" Stretch="Uniform"
Data="{Binding (local:Attached.IconPath), RelativeSource={RelativeSource TemplatedParent}}"/>
</Viewbox>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Stroke" TargetName="Icon" Value="Gray"/>
<Setter …Run Code Online (Sandbox Code Playgroud) 我可能有完全错误,但我的理解是--standalone编译器选项告诉编译器在exe中包含F#核心和其他依赖项,这样您就可以在另一台机器上运行它而无需安装任何"运行时".
但是,我无法在CTP中使用它 - 它甚至似乎都没有改变输出文件的大小(我读过的文档说的是1M额外的).
"谷歌可能知道,但如果确实如此,那就说不出来了,或者我找不到合适的地方"
更新:
它似乎适用于最新的CTP 更新1.9.6.2
UPDATE2:
此后我又遇到了另一个错误:
FSC(0,0): error FS0191: could not resolve assembly Microsoft.Build.Utilities.
Run Code Online (Sandbox Code Playgroud)
如果在尝试编译时遇到这样的错误--standalone,则需要在项目中明确地将它们作为引用包含在内.
c# ×4
f# ×3
git ×2
.net-4.0 ×1
agent ×1
async-await ×1
c#-to-f# ×1
cherry-pick ×1
constructor ×1
debugging ×1
rebase ×1
syntax ×1
wcf-web-api ×1
xaml ×1