编译ASP.NET 5 Web应用程序并生成DLL文件(Compiling an ASP.NET 5 Web Application and generating DLL files)
我创建了一个ASP.NET 5 Web应用程序。 在使用类库项目时 ,我遇到了一些错误。 所以,我添加了类文件并编写了业务逻辑和数据访问逻辑。 使用Visual Studio 发布后,Output文件夹包含实际的源代码,并且编译的DLL不存在。 如何与我的客户端共享已编译的文件以进行部署而不是实际的源代码?
通过在Build选项中选择Build on yield on build ,可以生成 DLL。 如何使用此DLL与DNX命令进行托管?
在其中一个站点中,提到我们可以预编译Web应用程序。 如何才能做到这一点?
I created an ASP.NET 5 Web Application. While using Class Library Projects, I got some errors. So, I added class files and wrote my business logic and data access logic. After Publishing using Visual Studio, the Output folder contains the actual source code and compiled DLLs are not present. How can I share the compiled files with my client for deployment and not the actual source code?
By selecting the Produce outputs on build in the Build option, a DLL is generated. How can I use this DLL with DNX command for hosting?
In one of the sites, it was mentioned that we can Pre-compile the Web Application. How can this be done?
原文:https://stackoverflow.com/questions/35657978
最满意答案
问题是
validatestring
从cell参数({'imag',''}
)返回匹配的字符串,而不是指示它是否通过验证的布尔值。 相反,使用strcmp
和any
:@(x) any(strcmp(x,{'imag', ''}))
另外,使用
validatestring
,如果输入字符串不匹配'imag'
或''
(实际上只是'imag'
因为空字符串仅在R2014a +中匹配),它会抛出错误而不是返回false,以便inputParser
可以返回适当的错误。修复问题的另一个好方法是完全改变
applyFunc
的语法,以便使用带有'imag'
作为参数的参数值和作为输入的有效布尔值来代替'imag'
作为可选的字符串输入参数。Amro在评论中建议的输入定义:
p.addParameter('imag', false, @(x)validateattributes(x, {'logical'}, {'scalar'}))
用法:
mysum(x,'imag',true) mysum(x) % default is equivalent to mysum(x,'imag',false)
这将简化代码的其余部分,
p.Result.imag
是一个logical
标量。 我会建议:x = f(v) + p.Result.imag*1i;
The problem is that
validatestring
returns the matching string from the cell argument ({'imag',''}
) rather than a Boolean indicating if it passes validation. Instead, usestrcmp
andany
:@(x) any(strcmp(x,{'imag', ''}))
Also, with
validatestring
, if the input string did not match either'imag'
or''
(actually just'imag'
since empty strings only match in R2014a+), it would throw an error rather than returning false so that theinputParser
could return the appropriate error.Another nice way to fix the problem is to change the syntax of
applyFunc
entirely so that instead of just'imag'
as an optional string input argument, use a Parameter-Value with'imag'
as the parameter and a validated boolean as the input.The input definition suggested by Amro in the comments:
p.addParameter('imag', false, @(x)validateattributes(x, {'logical'}, {'scalar'}))
The usage:
mysum(x,'imag',true) mysum(x) % default is equivalent to mysum(x,'imag',false)
This would simplify the rest of the code with
p.Result.imag
being alogical
scalar. I would suggest:x = f(v) + p.Result.imag*1i;
相关问答
更多-
你不能得到一个整数的“切片”。 首先,您需要将其转换为字符串。 x[::-1] < - 如果x是整数,则此操作是非法的。 顺便说一句,这可以更好地编写为几个函数 - 执行计算的函数,以及在特定约束下运行函数的函数,并且接受return_length = True参数。 def reverse(n): return int(str(n)[::-1]) def is_palindrome(n): return str(n) == str(n)[::-1] def alg196(n, retu ...
-
我能想到的最优雅的解决方案是对inputParser进行子类inputParser 。 所以你可以做这样的事情(另存为myInputParser.m): classdef myInputParser < inputParser properties required = {}; end methods function obj = myInputParser obj = obj@inputParser; end ...
-
不幸的是, inputParser类本身不足以解决这个问题。 您可以使用inputParser单独检查每个输入,但您必须自己进行更复杂的处理。 类似于以下内容: function out = createRVE(domain, distribution, varargin) inputs = parseInputs(domain, distribution, varargin{:}); % rest of the function end function inputs = parse ...
-
inputParser是在GNU Octave 4.0中实现的,所以看起来你使用的是旧版本。 更新Octave或降级信号。 inputParser was implemented in GNU Octave 4.0 so it looks like you are using an older version. Either update Octave or downgrade signal.
-
Matlab字符串输入(Matlab String Input)[2023-11-22]
ischar和iscellstr可以告诉你输入是包含字符串(char数组)的char数组还是单元数组。 bin2dec和hex2dec会将字符串转换为数字。 ischar and iscellstr can tell you if the input is a char array or cell array containing strings (char arrays). bin2dec and hex2dec will convert strings to numbers. -
(以下信息来自Apple Developer Forum中对我的问题https://forums.developer.apple.com/thread/28272的回复。) 您可以将.SubstringNotRequired选项传递给enumerateSubstringsInRange() ,然后使用substring == nil调用闭包。 此选项记录为 NSStringEnumerationSubstringNotRequired 一种指示块不需要子字符串的方法,在这种情况下将传递nil。 这只是一个性 ...
-
在回调中,你只需要指定你真正需要使用的参数。 实际上没有“需要”。 $.each(array,function(k){ console.log(k); }); 在功能上与以下相同: $.each(array,function(k,v){ console.log(k); }); 假设你不需要在回调的某个地方使用该值。 现在......这是说。 $.each(array,function(v){ console.log(v); }); 不一样: $.each(array,function(k,v){ co ...
-
没有什么可以阻止你调用parse一次,然后添加新的输入并再次调用parse - 此时你可以在验证函数中使用先前解析的值。 validateattributes函数在这里用于构建具有多个条件的验证函数。 例如: % My function function [result] = myLogSum(a,b) % Create an input parser p = inputParser; % Add required inputs with validation addRequired(p, 'a', @( ...
-
问题是validatestring从cell参数( {'imag',''} )返回匹配的字符串,而不是指示它是否通过验证的布尔值。 相反,使用strcmp和any : @(x) any(strcmp(x,{'imag', ''})) 另外,使用validatestring ,如果输入字符串不匹配'imag'或'' (实际上只是'imag'因为空字符串仅在R2014a +中匹配),它会抛出错误而不是返回false,以便inputParser可以返回适当的错误。 修复问题的另一个好方法是完全改变applyFu ...
-
我没有找到任何实际的理由来创建一个依赖于除标量之外的任何东西的if语句。 关于在MATLAB中实际做了什么? 您可以假设MATLAB在if语句的输入上应用all函数。 鉴于数组非空,这将成为直觉。 例如,如果我们有数组 - array4Example不是空的,那么语句if在数组上 - if(array4Example)等价于语句上的标量 - if(all(array4Example(:))) 。 如果是if函数,这与文档匹配。 I don't find any practical reason to cre ...