尝试使用aspnet_compiler发布后出现以下错误
errorASPPARSE: Circular file references are not allowed.
errorASPPARSE: Unknown server tag 'uc2:FAQ'.
errorASPPARSE: Could not load type 'CompoundControls.BBar'.
errorASPPARSE: Could not load type 'CompoundControls.PPIndicator'.
errorASPPARSE: Unknown server tag 'm:Calendar'.
errorASPPARSE: Could not load type 'SharedUserControls.VCDetails'.
errorASPPARSE: Could not load type 'SharedUserControls.VPDetails'.
errorASPPARSE: Could not load type 'SharedUserControls.VPrDetails'.
errorASPPARSE: Could not load type '.PopupPaymentCardCCVHelp'.
Run Code Online (Sandbox Code Playgroud)
任何想法如何解决它们
我正在尝试使用aspnet_compiler将已经从一个位置编译的项目移动到另一个位置.我正在使用Subversion进行版本控制.
该过程基本上从subversion中获取所有代码,进行构建,然后调用aspnet_compiler.
当我有一个排除的ascx文件时,我的问题就出现了.这个文件是最新代码的一部分,但普通的构建编译器会忽略它,所以没问题.但是,Aspnet_compiler会爆炸,因为它找不到该特定控件的代码.
我不确定
我很感激任何帮助.
汤姆
我的解决方案包含一些.net项目,其中一个是ASP.NET MVC项目,我正在尝试发布.所有配置都设置正确,x32和x64,其中没有设置为AnyCPU.
问题:
如果我尝试将项目发布为32位,一切都很好,但尝试以64位模式发布失败并显示错误:
Could not load file or assembly "ProjectA" or one of its dependencies.
An attempt was made to load a program with an incorrect format.
Run Code Online (Sandbox Code Playgroud)
我尝试过并注意到了什么:
自VS 2013以来,MSbuild是VS的一部分而不是.NET Framework的一部分.如果我只是在x64模式下构建解决方案,那么32位msbuild "C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe"首先运行并启动64位msbuild "C:\Program Files (x86)\MSBuild\12.0\Bin\amd64\MSBuild.exe"所以正常构建没有发布工作就好了.
但是,如果我选择publish,32位MSbuild首先运行,然后它启动32位aspnet_compiler c:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_compiler.exe而不是64位,这导致我上面提到的错误.
到目前为止,我发现的唯一解决方法是更换
"C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe"
Run Code Online (Sandbox Code Playgroud)
64位的
"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_compiler.exe"
Run Code Online (Sandbox Code Playgroud)
题:
对我的问题有没有更好的(合法的)解决方案?这看起来像VS中的一个错误
msbuild asp.net-mvc aspnet-compiler visual-studio visual-studio-2013
有没有办法让aspnet_compiler遍历所有视图并返回所有错误,而不仅仅是当前视图目录中的错误?
例如,假设我有一个包含大量文件夹的项目......
Views
Folder1Folder2Folder3Folder4其中两个(Folder2和Folder3)有错误.aspnet_compiler将运行,并且只返回它遇到的错误Folder2.它不会同时归还那些Folder3.一旦我修复了错误Folder2并再次运行它,它就会拿起那里的错误Folder3.我修复了那些.然后必须再次运行该工具,并再次运行,直到它全部修复.
这太烦人了!!
作为参考,这是我使用的命令:
C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_compiler -v / -p "C:\path\to\project"
Run Code Online (Sandbox Code Playgroud)
提前致谢!
我正在使用 MAC,我的机器上安装了 dotnet core 3.1、5.0 和 6.0 版本。由于此票证中的共享错误,我无法在我的计算机上构建 Web 应用程序。
我可以在目标框架net5.0中构建Web应用程序,但不能使用net6.0和控制台,类库项目构建成功。我尝试使用命令行 VS 2022/2019 进行构建,但没有成功。
项目文件代码如下,这是空的 Web API 项目。
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.1.5" />
</ItemGroup>
</Project>
Run Code Online (Sandbox Code Playgroud)
/usr/local/share/dotnet/sdk/6.0.100-rc.2.21505.57/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(5,5):错误NETSDK1177:无法签名apphost 错误代码为0:/Users/abc/Projects/WebAppTest/WebAppTest/obj/Debug/net6.0/apphost:已签名(NETSDK1177)(WebAppTest)
.NET SDK (reflecting any global.json):
Version: 6.0.100-rc.2.21505.57
Commit: ab39070116
Runtime Environment:
OS Name: Mac OS X
OS Version: 11.6
OS Platform: Darwin
RID: osx.11.0-x64
Base Path: /usr/local/share/dotnet/sdk/6.0.100-rc.2.21505.57/
Host (useful for support):
Version: 6.0.0-rc.2.21480.5
Commit: 6b11d64e7e
.NET SDKs installed:
3.1.414 [/usr/local/share/dotnet/sdk]
5.0.402 [/usr/local/share/dotnet/sdk]
6.0.100-rc.2.21505.57 [/usr/local/share/dotnet/sdk] …Run Code Online (Sandbox Code Playgroud) 我有一个在Windows 7上构建良好的Web项目,没有错误.当我升级到Windows 8时,将项目编译为已编译的网站会引发错误.从csproj文件(不创建一个网站)编译工作正常.这是msbuild抛出的实际错误
ASPNETCOMPILER:错误ASPRUNTIME:startIndex不能大于字符串的长度.[mycsproj.file.here]
msbuild正在运行的抛出错误的行是
C:\ Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe -v/-p my.physical.project.path -u my.physical.project.path\buildartifacts\CompiledWebsite
通过-errorstack标记运行aspnet_compiler,我也能够获得堆栈跟踪,这就是它生成的内容
[ArgumentOutOfRangeException]: startIndex cannot be larger than length of string.
Parameter name: startIndex
at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
at System.Web.Compilation.DiskBuildResultCache.MarkAssemblyAndRelatedFilesForDeletion(String assemblyName)
at System.Web.Compilation.DiskBuildResultCache.CacheBuildResult(String cacheKey, BuildResult result, Int64 hashCode, DateTime utcStart)
at System.Web.Compilation.BuildManager.CacheBuildResultInternal(String cacheKey, BuildResult result, Int64 hashCode, DateTime utcStart)
at System.Web.Compilation.WebDirectoryBatchCompiler.CacheAssemblyResults(AssemblyBuilder assemblyBuilder, CompilerResults results)
at System.Web.Compilation.WebDirectoryBatchCompiler.CompileAssemblyBuilder(AssemblyBuilder builder)
at System.Web.Compilation.WebDirectoryBatchCompiler.<CompileNonDependentBuildProviders>b__0(AssemblyBuilder assemblyBuilder)
at System.Web.Compilation.CompilationUtil.CompileParallel(ICollection assemblyBuilders, Action`1 action)
at System.Web.Compilation.WebDirectoryBatchCompiler.CompileNonDependentBuildProviders(ICollection buildProviders)
at System.Web.Compilation.WebDirectoryBatchCompiler.Process()
at System.Web.Compilation.BuildManager.BatchCompileWebDirectoryInternal(VirtualDirectory vdir, Boolean ignoreErrors)
at System.Web.Compilation.BuildManager.BatchCompileWebDirectory(VirtualDirectory …Run Code Online (Sandbox Code Playgroud) 这个问题很相似,但我认为不一样
msbuild ASPNETCOMPILER ASPNETRUNTIME startIndex错误
我有一个Web应用程序,我试图使用Visual Web Developer 2010 Express发布.
如果我在本地或生产服务器上发布,它没有任何区别,UNCHECK Precompile during publishing一切都会正常工作,它将发布和工作,没有运行时错误.
但是,如果我检查上面的内容,那么我收到一个错误:
Error 1 startIndex cannot be larger than length of string. ASPNETCOMPILER 0 0 bms
Run Code Online (Sandbox Code Playgroud)
没有其他错误,也没有其他信息!
谁能帮助我甚至开始追踪这个?
asp.net msbuild publish aspnet-compiler visual-web-developer-2010
在编码时,出现了差异.通常在编写简单方法或构造函数时,我经常使用表达体技术.但是,当我生成以下内容时:
public class Sample : ISample
{
private readonly IConfigurationRoot configuration;
public Sample(IConfigurationRoot configuration) => this.configuration = configuration;
}
Run Code Online (Sandbox Code Playgroud)
代码似乎是有效的,Visual Studio和编译都工作.问题虽然来自同一个类,我去使用configuration变量.它产生"字段初始值设定项不能引用非静态字段初始值设定项".
产生的语法用法:
var example = configuration.GetSection("Settings:Key").Value;
Run Code Online (Sandbox Code Playgroud)
但是,如果我将片段留在此上方并修改为块体.Visual Studio不再吓坏了,为什么表达体会导致如此特殊的错误?块体与上面的片段一起正常工作吗?
public class Sample : ISample
{
private readonly IConfigurationRoot configuration;
public Sample(IConfigurationRoot configuration)
{
this.configuration = configuration;
}
}
Run Code Online (Sandbox Code Playgroud)
public class ApplicationProvider
{
public IConfigurationRoot Configuration { get; } = CreateConfiguration();
public IServiceProvider BuildProvider()
{
var services = new ServiceCollection();
DependencyRegistration(services);
return services.AddLogging().BuildServiceProvider();
}
private IConfigurationRoot CreateConfiguration() => new …Run Code Online (Sandbox Code Playgroud) 我需要设置 debug='false'
<compilation debug="false" targetFramework="4.0" />
Run Code Online (Sandbox Code Playgroud)
即使在发布模式下发布我的代码.
正如MSDN编译概述中所述,它是在两个阶段完成的
发布代码是指第1阶段的部分,
<compilation ....是指阶段2.
Windows 4.5 x64上的.NET 4.5.2,IIS 8.5.我在/ localhost /有一个ASP.NET网站.DEFAULT网站已禁用,新网站使用正确的绑定创建.我正在尝试将其预编译到位:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319> aspnet_compiler -c -v /
error ASPRUNTIME: Failed to map the path '/'.
Run Code Online (Sandbox Code Playgroud)
我尝试了元数据库路径路由:
aspnet_compiler -c -m lm/w3svc/2/root
error ASPRUNTIME: Failed to map the path '/'.
Run Code Online (Sandbox Code Playgroud)
我可以通过指定物理路径来编译它,但我不想这样做,因为同一个应用程序存在于具有不同物理路径(开发,QA,生产)的不同服务器上.甚至配置数据库路径都不相同."/"到处都是一样的.
为了笑容,我把它添加到网站的一个页面,以确保我没有失去理智:
Response.Write(Server.MapPath("/"));
Run Code Online (Sandbox Code Playgroud)
得到了我的预期.
我究竟做错了什么?
aspnet-compiler ×10
msbuild ×5
asp.net ×2
asp.net-core ×2
asp.net-mvc ×2
.net ×1
.net-4.0 ×1
.net-6.0 ×1
.net-core ×1
asp.net-4.5 ×1
c# ×1
iis-7.5 ×1
publish ×1
svn ×1
web-config ×1
windows-8 ×1