小编Bla*_*ord的帖子

无法找到与其中一个目标运行时兼容的框架.NETCoreApp = v1的运行时目标

我试图迁移一个Asp.Net核心RC1项目RC2和一直在关注这个文件和也按指示为DNX迁移到.NET CLI.

我尝试时收到以下错误dotnet run:

无法找到与其中一个目标运行时兼容的框架'.NETCoreAPP,Version = v1.0'的运行时目标:'win10-x64,win81-x64,win8-x64,win7-x64'.可能的原因:

  1. 项目尚未恢复或恢复失败-run'netnet restore'
  2. 该项目没有列出'runtimes'中的'win10-x64,win81-x64,win7-x64'之一

我跑了dotnet restore,似乎已经成功完成了.

我已将所有相关包更新到RC2.

asp.net

149
推荐指数
6
解决办法
5万
查看次数

Visual Studio 2015 RC Gulp任务运行器未检测到任务

我在Visual Studio 2015 RC中有一个Gulpfile.js,只有一个默认任务.出于某种原因,它没有出现在Task Runner Explorer.

我已经将gulp添加到我package.json文件中的devDependencies 并保存了它.

gulp visual-studio-2015

20
推荐指数
3
解决办法
2万
查看次数

ASP.NET Core默认调试启动URL

使用ASP.NET Core Web API模板时,默认调试启动URL以某种方式设置为api/values.这是默认配置的位置,如何更改?

asp.net-core-mvc asp.net-core

17
推荐指数
1
解决办法
4583
查看次数

查找资源字典时发生错误

我在App.xaml主程序集中有一个合并的资源字典,它结合了来自不同程序集的各种资源字典:Common和PresentationLayer.

<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="/Common;component/Themes/Button.xaml"/>
            <ResourceDictionary Source="/PresentationLayer;component/DataTemplates/AppointmentsDataTemplates.xaml"/>
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Application.Resources>
Run Code Online (Sandbox Code Playgroud)

在运行时,资源字典中的样式将正确应用于控件.但是,在设计时不会应用样式,Visual Studio 2012会不断出现以下错误:

An error occurred while finding the resource dictionary "/Common;component/Themes/Button.xaml".
Run Code Online (Sandbox Code Playgroud)

并警告:

The resource "BannerButton" could not be resolved.
Run Code Online (Sandbox Code Playgroud)

我遇到过这篇文章,但问题仍然存在,尽管Build Action设置为Resource.此外,我在Visual Studio 2010或Expression Blend 4下运行时没有遇到此问题.主程序集肯定包含对Common程序集的引用,我没有更改Pack URI.

wpf visual-studio-2012

16
推荐指数
2
解决办法
2万
查看次数

当前运行时目标框架与项目不兼容

我正在尝试在添加Entity Framework 7到我的Asp.Net 5项目后执行初始迁移.我正在关注此文档.

在我的project.json指定中:

  "commands": {
    "web": "Microsoft.AspNet.Server.Kestrel",
    "ef": "EntityFramework.Commands"
  },

  "frameworks": {
    "dnxcore50": { }
  }
Run Code Online (Sandbox Code Playgroud)

我试图通过命令提示符在项目目录中执行以下命令:

dnx ef migrations add MyFirstMigration
Run Code Online (Sandbox Code Playgroud)

但是我收到以下错误:

System.InvalidOperationException:当前运行时目标框架与ProjectName不兼容.当前运行时目标框架:'DNX,Version = v 4.5.1(dnx451)请确保运行时与project.json中指定的框架匹配.

奇怪的是,我project.json绝对是针对性的dnxcore50.我也签到了global.json:

{
  "projects": [ "src", "test" ],
  "sdk": {
    "version": "1.0.0-beta8",
    "architecture": "x86",
    "runtime": "coreclr"
  }
}
Run Code Online (Sandbox Code Playgroud)

我的包依赖项都引用了beta8:

  "dependencies": {
    "EntityFramework.Commands": "7.0.0-beta8",
    "EntityFramework.Core": "7.0.0-beta8",
    "EntityFramework.SqlServer": "7.0.0-beta8",
    "Hl7.Fhir.DSTU2": "0.90.2",
    "Microsoft.AspNet.Authentication.Cookies": "1.0.0-beta8",
    "Microsoft.AspNet.Authentication.OpenIdConnect": "1.0.0-beta8",
    "Microsoft.AspNet.Diagnostics": "1.0.0-beta8",
    "Microsoft.AspNet.IISPlatformHandler": "1.0.0-beta8",
    "Microsoft.AspNet.Mvc": "6.0.0-beta8",
    "Microsoft.AspNet.Mvc.TagHelpers": …
Run Code Online (Sandbox Code Playgroud)

entity-framework-core asp.net-core

13
推荐指数
1
解决办法
3451
查看次数

我应该在哪里定义我的datatemplates?

我正在尝试找出在MVVM中耦合我的Views和ViewModel的最佳方法,并且我已经使用类型化的 DataTemplates 确定了ViewModel优先方法,如本文本答案中所述.我正在使用Prism并拥有多个具有自己的项目/类库的模块.

我的问题是:我的DataTemplates在我的解决方案中应该在哪里?

  1. 我应该将DataTemplates放在资源字典中,该资源字典位于具有它呈现的类型/ ViewModels的同一项目中吗?
  2. 我应该将DataTemplates放在一个资源字典中,该字典位于具有应用程序MainWindow(即Shell.xaml)的项目中吗?
  3. 是否应该将这些资源字典添加到App.Current.MainWindow.Resources.MergedDictionaries

我希望这足以描述我正在尝试做的事情.

更新:查看所选答案的评论.

wpf user-controls datatemplate mvvm

10
推荐指数
1
解决办法
6116
查看次数

文本框不会拉伸以填充视图框

我希望我的LOB表单中的标签和文本框的字体大小随着窗口大小调整或分辨率更改而增大和缩小.为此,我将标签和文本框放在了视图框中.

标签和自定义单选按钮的行为符合我的预期,但文本框不会水平拉伸以填充视图框(抱歉,由于rep而无法发布图像).如果您键入文本框,文本框将水平填充视图框.

以下是我正在使用的代码示例:

  <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="0.186*"/>
            <ColumnDefinition Width="0.814*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="0.127*"/>
            <RowDefinition Height="0.873*"/>
        </Grid.RowDefinitions>
        <Viewbox Margin="0,0,0.917,0">
            <Label Content="First name:"/>
        </Viewbox>
        <Viewbox Grid.Column="1">
            <TextBox TextWrapping="Wrap"/>
        </Viewbox>
    </Grid>
Run Code Online (Sandbox Code Playgroud)

我已经尝试在视图框中放置网格,stackpanel和dockpanel(使用LastChildFill ="True"),然后将文本框放在这些布局控件中,但这也不起作用.反正有没有让文本框水平填充父视图框?

此问题与此类似:WPF TextBox不会填写StackPanel,但此问题与stackpanels有关,而不是viewboxes.

forms wpf layout textbox viewbox

7
推荐指数
1
解决办法
2万
查看次数

angular.js的Intellisense在javascript文件中不起作用

我正在使用支持Angular.js的Intellisense的Visual Studio 2013.当我在HTML5文件的脚本标记中创建Angular.js模块时,Intellisense确实有效.但是,当我尝试在javascript文件中创建相同的模块时,我得不到Intellisense.我有点困惑,为什么会这样.

Intellisense在HTML文件中工作:

HTML文件中的Angular.js Intellisense

空白javascript文件中没有Intellisense:

在javascript文件中没有Intellisense

我在VS2013中没有安装Resharper.在此先感谢您的时间和任何建议!

visual-studio-2013

7
推荐指数
2
解决办法
6553
查看次数

依赖关系microsoft.aspnetcore.mvc 1.0.0不支持框架.NETCoreApp,Version = v1.0

尝试创建一个ASP.NET核心项目,因为它刚刚达到了RTM.我使用名为"ASP.NET Core Web Application(.NET Core)"的Visual Studio 2015 Update 3模板创建了一个新项目.然后我去了Nuget Package Manager并将所有package.json软件包更新到1.0.0.Visual Studio无法使用此帖子标题中的错误还原包.

这是project.json更新后的Nuget包:

{ 
  "dependencies": {
    "Microsoft.AspNetCore.Mvc": "1.0.0",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
    "Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
    "Microsoft.Extensions.Configuration.Json": "1.0.0",
    "Microsoft.Extensions.Logging": "1.0.0",
    "Microsoft.Extensions.Logging.Console": "1.0.0",
    "Microsoft.Extensions.Logging.Debug": "1.0.0",
    "Microsoft.NETCore.App": "1.0.0"
  },

  "tools": {
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": {
      "version": "1.0.0-preview-final",
      "imports": "portable-net45+win8+dnxcore50"
    }
  },

  "frameworks": {
    "netcoreapp1.0": {
      "imports": [
        "dotnet5.6",
        "dnxcore50",
        "portable-net45+win8"
      ]
    }
  },

  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  },

  "runtimeOptions": {
    "gcServer": true
  },

  "publishOptions": {
    "include": [
      "wwwroot", …
Run Code Online (Sandbox Code Playgroud)

asp.net-core

7
推荐指数
1
解决办法
5369
查看次数

如何在选择结果后清除预先输入?

我正在使用ng-bootstrap typeahead组件来搜索客户数据库.当用户从预先输入结果列表中选择客户时,我会导航到客户详细信息页面.我有这个工作,但我想在导航发生后清除输入字段.我已经尝试将模型设置为null或selectItem事件逻辑中的空字符串,但这不起作用:

客户搜索typeahead.component.html

<template #resultTemplate let-r="result" let-t="term">
  <div>
    <div>
      {{r.resource.name[0].given}} {{r.resource.name[0].family}}
    </div>
    <div>
      {{r.resource.birthDate | date: 'dd/MM/yyyy'}}
    </div>
  </div>
</template>

<input type="text" class="form-control" [resultTemplate]="resultTemplate" (selectItem)="onSelect($event)"
       [(ngModel)]="model" placeholder="Start typing a customer name..." [ngbTypeahead]="search"/>
Run Code Online (Sandbox Code Playgroud)

客户搜索typeahead.component.ts

@Component({
  selector: 'customer-search-typeahead',
  template: require('./customer-search-typeahead.component.html'),
  styles: [`.form-control { width: 300px; }`]
})
export class CustomerSearchTypeaheadComponent {

  model: any;
  searching: boolean;

  constructor(private customerService: CustomerService, private router: Router) {}

  onSelect($event) {
    this.router.navigate(['/customers', $event.item.resource.id]);
    this.model = null;
  };

  search = (text$: Observable<string>) =>
   //omitted for brevity …
Run Code Online (Sandbox Code Playgroud)

typeahead ng-bootstrap

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