小编Ogg*_*las的帖子

如何向Visual Studio 2017添加功能?

假设当我安装Visual Studio 2017时,我决定使用"Windows Universal Platform"软件包.后来,我意识到我想安装".Net桌面软件包"(相反,或者另外).

如何返回并将这些功能添加到Visual Studio 2017?有没有办法在Visual Studio中执行此操作?我必须重新运行安装程序吗?

c# visual-studio visual-studio-2017

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

安装Nuget Package错误"​​路径不是合法形式"

在尝试安装NuGet Package RestSharp时,我收到错误The path is not of a legal form并且未安装软件包.

使用时从控制台进行安装时Install-Package RestSharp,会出现以下消息:

在您的工作区中找不到项C:\ Users\myName\Source\Workspaces\Project\Solution\packages\RestSharp.105.1.0\lib \net35\RestSharp.dll,或者您无权访问它.

这是在新发布的Visual Studio 2015(社区版)中发生的.

c# visual-studio nuget visual-studio-2015

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

VS2015 - 更改TypeScript版本

我正在尝试更新我的Visual Studio 2015 + Cordova + TypeScript项目以使用TypeScript版本1.6.0-beta.我目前正在使用1.5.3.

我可以使用NPM安装最新版本,但我的项目继续使用旧版本. npm install -g typescript

如何让我的项目使用最新的TypeScript版本?

TypeScript版本的位置:

1.5.3 = C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.5

1.6.0-beta = C:\Users\XXX\AppData\Roaming\npm

--------------------- 2015年9月4日更新----------------------- ---

我将项目.jsproj文件的XML元素更新<TypeScriptToolsVersion>1.5</TypeScriptToolsVersion><TypeScriptToolsVersion>1.6.0-beta</TypeScriptToolsVersion>.我添加了文件夹1.6.0-beta和NPM文件C:\Program Files (x86)\Microsoft SDKs\TypeScript,VS2015不使用最新的TypeScript. 在此输入图像描述

我错过了什么吗?

c# visual-studio-cordova visual-studio-2015

31
推荐指数
3
解决办法
5万
查看次数

EF 更新数据库错误:值不能为空参数名称:类型

我尝试update-database在 PMC 中执行命令,但总是收到此错误消息。我知道另一篇文章基本上有相同的错误,但我尝试了每个答案,但没有任何效果。

System.ArgumentNullException: Value cannot be null.
Parameter name: type

at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(Type type, Object[] args)
at System.Data.Entity.Migrations.Extensions.ProjectExtensions.GetProjectTypes(Project project, Int32 shellVersion)
at System.Data.Entity.Migrations.Extensions.ProjectExtensions.IsWebSiteProject(Project project)
at System.Data.Entity.Migrations.Extensions.ProjectExtensions.GetTargetDir(Project project)
at System.Data.Entity.Migrations.MigrationsDomainCommand.GetFacade(String configurationTypeName, Boolean useContextWorkingDirectory)
at System.Data.Entity.Migrations.UpdateDatabaseCommand.<>c__DisplayClass2.<.ctor>b__0()
at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command)

Value cannot be null.
Parameter name: type
Run Code Online (Sandbox Code Playgroud)

顺便说一句,我正在使用 VS2022 预览版。

.net c# entity-framework code-first

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

'T MaxInteger[T](System.Collections.Generic.IEnumerable`1[T])' 上的 System.DateTime 违反了使用 AutoMapper 11.0.1 的 .NET 7 类型 T 的约束

完整源码;

// See https://aka.ms/new-console-template for more information
using AutoMapper;

Console.WriteLine("Hello, World!");

var mapperConfig = new MapperConfiguration(mc =>
{
    mc.AddProfile(new MappingProfile());
});
//mapperConfig.AssertConfigurationIsValid();

IMapper mapper = mapperConfig.CreateMapper();

var entity = new Entity() { Created = DateTime.Now };

var entityDto = mapper.Map<Entity, EntityDto>(entity);

Console.WriteLine("Test");

public class MappingProfile : Profile
{
    public MappingProfile()
    {
        CreateMap<Entity, EntityDto>().ReverseMap();
    }
}

public class Entity
{
    public Guid Guid { get; set; }

    public DateTime Created { get; set; }

    public string CreatedById { get; set; } …
Run Code Online (Sandbox Code Playgroud)

.net c# automapper nuget automapper-11

24
推荐指数
1
解决办法
7374
查看次数

NuGet System.Drawing.Common .NET 6 CA1416 此调用站点可在所有平台上访问。“Image.FromStream(Stream)”仅支持:“windows”

将 NuGet 升级System.Drawing.Common到 6.0.0 会导致以下错误:

CA1416 此调用站点可在所有平台上访问。“Image.FromStream(Stream)”仅在“windows”上受支持。

https://www.nuget.org/packages/System.Drawing.Common/

受影响的代码如下:

var drawingImage = System.Drawing.Image.FromStream(memstr);
Run Code Online (Sandbox Code Playgroud)

我们使用该库来访问该方法GetThumbnailImage

public byte[] GetThumbnailBytes(byte[] imageBytes)
{
    var thumbnailBytes = Array.Empty<byte>();

    using (MemoryStream memstr = new MemoryStream(imageBytes))
    {
        var drawingImage = System.Drawing.Image.FromStream(memstr);
        var thumbnailSize = GetThumbnailSize(drawingImage);

        var thumbnail = drawingImage.GetThumbnailImage(thumbnailSize.Width, thumbnailSize.Height, null, IntPtr.Zero);

        var ms = thumbnail.ToStream(drawingImage.RawFormat);

        thumbnailBytes = ms.ReadFully();
    }

    return thumbnailBytes;
}
Run Code Online (Sandbox Code Playgroud)

我们仅在 Azure 上托管应用程序,因此针对 Windows 是可以的,但替换GetThumbnailImage也是可以接受的。

.net c# .net-6.0

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

Visual Studio 2015 - "无法执行.操作无法完成.应执行重试"

调试时出现以下错误:

无法步骤.操作无法完成.应该重试

单击"确定"后,对话框返回:

调试器无法继续运行该过程.操作无法完成.应该重试.

解决方案设置为"Debug"和"Any CPU".重新启动应用程序后,我可以单步执行代码,但需要5-10秒才能执行通常即时执行的操作.但是,CPU,RAM和HDD正常运行而不是峰值.还有其他人经历过这个吗?

c# visual-studio visual-studio-2015

22
推荐指数
3
解决办法
1万
查看次数

webpack 4.1.1 - > configuration.module有一个未知的属性'loaders'.

我刚刚更新了webpack 4.1.1,当我尝试运行它时,我收到以下错误:

配置对象无效.Webpack已使用与API架构不匹配的配置对象进行初始化. - configuration.module有一个未知的属性'loaders'.这些属性是有效的:object {exprContextCritical?,exprContextRecursive?,exprContextRegExp?,exprContextRequest?,noParse ?, rules?,defaultRules?,unknownContextCritical?,unknownContextRecursive?,unknownContextRegExp?,unknownContextRequest?,unsafeCache?,wrappedContextCritical?,wrappedContextRecursive?,wrappedContextRegExp ?,strictExportPresence?,strictThisContextOnImports?} - >影响正常模块的选项(NormalModuleFactory).

loaders看起来像这样并使用webpack 3.11.0:

module: {
    loaders: [
        { test: /\.tsx?$/, loader: ['ts-loader'] },
        { test: /\.css$/, loader: "style-loader!css-loader" },
        {
            test: /\.scss$/, use: [{
                loader: "style-loader" // creates style nodes from JS strings
            }, {
                loader: "css-loader" // translates CSS into CommonJS
            }, {
                loader: "sass-loader" // compiles Sass to CSS
            }]
        },
        { test: /\.(otf|ttf|eot|svg|woff(2)?)(\?[a-z0-9=&.]+)?$/, loader: 'file-loader?name=./Scripts/dist/[name].[ext]' }
    ]
}
Run Code Online (Sandbox Code Playgroud)

javascript typescript webpack

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

在 Windows 上不使用 OpenSSL 从 pfx 文件或证书存储中提取私钥

正如标题所示,我想在不使用 OpenSSL 或任何其他第三方工具的情况下导出我的私钥。如果我需要一个.cer文件或.pfx文件,我可以通过 MMC 或 PowerShell 轻松导出这些文件,pkiclient但我找不到获取私钥的方法。

https://docs.microsoft.com/en-us/powershell/module/pkiclient/export-certificate?view=win10-ps

使用像https://www.sslshopper.com/ssl-converter.html这样的在线工具是不行的。

PS版本:

PS C:\Users\oscar> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.17134.228
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17134.228
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
Run Code Online (Sandbox Code Playgroud)

我可以像这样获得公钥:

(Get-PfxCertificate -FilePath C:\Users\oscar\Desktop\localhost.pfx).GetPublicKey()
Run Code Online (Sandbox Code Playgroud)

并像这样导出整个证书:

(Get-PfxCertificate -FilePath C:\Users\oscar\Desktop\localhost.pfx).GetRawCertData()
Run Code Online (Sandbox Code Playgroud)

结果来自

PS C:\Users\oscar> $mypwd = ConvertTo-SecureString -String "MyPassword" -Force -AsPlainText
PS C:\Users\oscar> $mypfx = Get-PfxData -FilePath C:\Users\oscar\Desktop\localhost.pfx -Password $mypwd
PS C:\Users\oscar> $mypfx

OtherCertificates EndEntityCertificates
----------------- ---------------------
{}                {[Subject]... …
Run Code Online (Sandbox Code Playgroud)

windows powershell certificate certificate-store

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

在Chrome或Firefox上使用Visual Studio 2015调试Java脚本

我可以毫无问题地使用IE进行调试,但是当我尝试不同的浏览器时,代码并没有停止在断点上.我有一个目前与IE不兼容的项目.我在项目中使用OpenJSCAD作为依赖项,因此我需要在Chrome或Firefox上进行调试.

是否可以在Chrome或Firefox上使用Visual Studio 2015调试Java Script?

javascript c# firefox google-chrome visual-studio

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