我正在使用NuGet来管理依赖项.我非常喜欢NuGet,它为我做了很多简单的事情.
在Visual Studio中,我使用自动包还原功能,以便在构建期间更新包.我还找到了一种让nuget.exe文件自行下载的方法.这很棒,这意味着开发人员可以查看源代码并构建它.它使依赖管理几乎成为"明智之举".
但是,我遇到了TeamCity CI构建的问题.在TeamCity中构建时,我更喜欢使用TC的NuGet Installer构建步骤.我发现这使我能够更直观地控制构建过程,这意味着我可以指定我想要使用的包源.但是,这与NuGet自动还原有些冲突,因为它会下载nuget.exe并尝试再次更新所有包.
构建确实有效但我可以通过避免第二次NuGet更新操作来提高效率,如果有很多依赖项,这可能需要一些时间.我需要的是一种只有在构建服务器上运行时才能阻止自动恢复的方法.有没有人想过这样做的方法?
当我编写这样的 MSpec 上下文时:
[Subject(typeof(TheType), "Concern")]
internal class when_this_test_is_run
{
Establish context = () =>
{
// some code...
};
Because of = () => Do.Something();
It should_do_this;
It should_do_that;
}
Run Code Online (Sandbox Code Playgroud)
当我让 ReSharper 重新格式化代码时,它总是在任何作为匿名方法的委托下方插入一个空行,即以块{作为}其主体。它不会在简单表达式的委托后面插入空行。因此,在上面的示例中,Establish context委托会生成一个空行,但Because of和It委托不会。
这让我发疯,因为我不希望它插入空行,但我不知道需要更改什么设置来阻止它发生。
有任何想法吗?
当.net程序集注册COM Interop时,注册表中有一个指向可执行文件的CodeBase项.
我的问题是:CodeBase密钥是特定于.NET的东西,还是这是一个通用的COM东西,所有注册的组件都应该有?
我的印象是Inno Setup完全绕过了Windows Installer.任何人都可以证实或反驳这一观点吗?
我刚刚开始使用ASP.net 5,MVC6和Entity Framework 7开展实验项目.我的ASP.Net Identity工作正常,但后来尝试将我自己的一些数据添加到DbContext并解决了这个问题.EF7报道:
处理请求时发生未处理的异常.
InvalidOperationException:未配置任何数据库提供程序.在设置服务时,通过在DbContext类或AddDbContext方法中覆盖OnConfiguring来配置数据库提供程序.
Microsoft.Data.Entity.Internal.DatabaseProviderSelector.SelectServices(ServiceProviderSource providerSource)堆栈查询Cookie标头
InvalidOperationException:未配置任何数据库提供程序.在设置服务时,通过在DbContext类或AddDbContext方法中覆盖OnConfiguring来配置数据库提供程序.
这是我的配置方法:
public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddApplicationInsightsTelemetry(Configuration);
services.AddEntityFramework()
.AddSqlServer()
.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(Configuration["Data:DefaultConnection:ConnectionString"]));
services.AddIdentity<ApplicationUser, IdentityRole>()
.AddEntityFrameworkStores<ApplicationDbContext>()
.AddDefaultTokenProviders();
services.AddMvc();
// Add application services.
services.AddTransient<IEmailSender, AuthMessageSender>();
services.AddTransient<ISmsSender, AuthMessageSender>();
services.AddTransient<ApplicationUnitOfWork>(instance => new ApplicationUnitOfWork());
}
Run Code Online (Sandbox Code Playgroud)
ApplicationUnitOfWork是一个超过EF7的外观,以减少紧耦合.到目前为止,这是整个事情:
public class ApplicationUnitOfWork : IUnitOfWork
{
readonly ApplicationDbContext dbContext;
public ApplicationUnitOfWork()
{
dbContext = new ApplicationDbContext();
Products = new ProductRepository(dbContext);
}
public void Dispose() { dbContext.Dispose(); }
public IUserRepository Users { get; }
public …Run Code Online (Sandbox Code Playgroud) c# ×2
.net ×1
asp.net-core ×1
build ×1
clsid ×1
codebase ×1
com ×1
com-interop ×1
inno-setup ×1
mspec ×1
nuget ×1
resharper ×1
teamcity ×1