VS 2010 预编译网站与构建过程?

发布于 2024-12-06 08:47:20 字数 429 浏览 1 评论 0原文

VS 2010;贸易融资2010; ASP.NET 4.0; 2010 年 Web 部署项目;

我正在使用构建过程模板来进行一键部署(仅适用于开发和质量检查)。我希望预编译我的网站。我可以使用命令行来完成

 C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler 
-v /site_name 
-p "C:\...\site_name" 
-f "C:\...\site_name1"

此操作,使用: 如果我将文件从 site_name1 复制到 site_name,则效果很好...

但是 IDE 中有一个选项吗?? 看起来确实如此必须从命令行执行此操作是愚蠢的。我读过很多关于不同选项的内容,但似乎没有一个适用于使用构建定义进行构建。

VS 2010; TFS 2010; ASP.Net 4.0; Web Deployment Projects 2010;

I am using the build process templates in order to do one-click deploys (for dev and QA only). I want my sites to be pre-compiled. I can do it with the command line, using:

 C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler 
-v /site_name 
-p "C:\...\site_name" 
-f "C:\...\site_name1"

and this works fine if I copy the files over from site_name1 to site_name...

but is there an option in the IDE for this?? It seems really silly to have to do this from the command line. I've read a lot about different options, but none seem applicable to building with the build definitions.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

泪意 2024-12-13 08:47:20

您可以通过将以下内容添加到 .csproj 文件

<PropertyGroup>
<PrecompileVirtualPath>/whatever</PrecompileVirtualPath>
<PrecompilePhysicalPath>.</PrecompilePhysicalPath>
<PrecompileTargetPath>..\precompiled</PrecompileTargetPath>
<PrecompileForce>true</PrecompileForce>
<PrecompileUpdateable>false</PrecompileUpdateable>
</PropertyGroup>

 <Target Name="PrecompileWeb" DependsOnTargets="Build">
<Message Importance="high" Text="Precompiling to $(PrecompileTargetPath)" />
<GetFullPath path="$(PrecompileTargetPath)">
  <Output TaskParameter="fullPath" PropertyName="PrecompileTargetFullPath" />
</GetFullPath>
<Message Importance="high" Text="Precompiling to fullpath: $(PrecompileTargetFullPath)" />
<GetFullPath path="$(PrecompilePhysicalPath)">
  <Output TaskParameter="fullPath" PropertyName="PrecompilePhysicalFullPath" />
</GetFullPath>
<Message Importance="high" Text="Precompiling from fullpath: $(PrecompilePhysicalFullPath)" />
<AspNetCompiler PhysicalPath="$(PrecompilePhysicalPath)" VirtualPath="$(PrecompileVirtualPath)" TargetPath="$(PrecompileTargetPath)" Debug="true" Force="$(PrecompileForce)" Updateable="$(PrecompileUpdateable)" FixedNames="true" />

中然后在 TFS2010 的默认模板中

  • 构建定义“
  • 进程”选项卡
  • “高级参数”部分
  • MSBuild Arguments
  • set /target="PrecompileWeb"

You can do this by adding the following to your .csproj file

<PropertyGroup>
<PrecompileVirtualPath>/whatever</PrecompileVirtualPath>
<PrecompilePhysicalPath>.</PrecompilePhysicalPath>
<PrecompileTargetPath>..\precompiled</PrecompileTargetPath>
<PrecompileForce>true</PrecompileForce>
<PrecompileUpdateable>false</PrecompileUpdateable>
</PropertyGroup>

 <Target Name="PrecompileWeb" DependsOnTargets="Build">
<Message Importance="high" Text="Precompiling to $(PrecompileTargetPath)" />
<GetFullPath path="$(PrecompileTargetPath)">
  <Output TaskParameter="fullPath" PropertyName="PrecompileTargetFullPath" />
</GetFullPath>
<Message Importance="high" Text="Precompiling to fullpath: $(PrecompileTargetFullPath)" />
<GetFullPath path="$(PrecompilePhysicalPath)">
  <Output TaskParameter="fullPath" PropertyName="PrecompilePhysicalFullPath" />
</GetFullPath>
<Message Importance="high" Text="Precompiling from fullpath: $(PrecompilePhysicalFullPath)" />
<AspNetCompiler PhysicalPath="$(PrecompilePhysicalPath)" VirtualPath="$(PrecompileVirtualPath)" TargetPath="$(PrecompileTargetPath)" Debug="true" Force="$(PrecompileForce)" Updateable="$(PrecompileUpdateable)" FixedNames="true" />

Then in TFS2010's default template

  • your build definition
  • Process tab
  • Advanced parameters section
  • MSBuild Arguments
  • set /target="PrecompileWeb"
天赋异禀 2024-12-13 08:47:20

就目前情况而言,我找不到任何 IDE 选项来使用构建过程模板预编译网站。我希望被证明是错误的,因为使用命令行 aspnet_compiler 需要我们(在我们的设置中)破解实际的构建过程模板,这是我们试图避免的。

我很想被证明是错的! :)

As it currently stands, I can not find any IDE option to pre-compile websites using the build process templates. I would love to be proved wrong, as using the command line aspnet_compiler requires us (in our setup) to crack open the actual build process template, which we are trying to avoid.

I would love to be proved wrong! :)

假情假意假温柔 2024-12-13 08:47:20

我们有一个网站作为 Web 应用程序存储在 TFS2010 中。我使用 MSBuild 命令从 TFS2010 进行部署。如果您在 VS2010 Team Explorer 中打开项目,您将看到有一个“构建”选项。如果添加构建并在“进程”选项卡中使用构建参数,例如 ...:/p:DeployOnBuild=True /p:DeployTarget=MsDeployPublish /p:CreatePackageOnPublish=True /p:MSDeployPublishMethod=RemoteAgent /p:MSDeployServiceUrl =http://111.111.111.111/msdeployagentservice /p:DeployIisAppPath=MySiteNameInIIS /p:UserName=myDomain\BuildUser /p:Password=BuildUserPassword 在“进程”选项卡中显示“要构建的项目”的地方,您只需将其指向您的 .sln 文件(可能与 .cspro 一起使用,但语法略有变化)

我们有一台 TFS2010 服务器,我将一些站点部署到开发、质量保证、预生产或生产 IIS 服务器。我对开发版本进行单元测试,如果测试失败,那么我不会部署。

MSBuild 命令进行预编译,这对您有用吗?

We have a website that is stored in TFS2010 as a Web application. I use a MSBuild command to deploy from TFS2010. If you open your project in VS2010 Team Explorer you will see there is a "Builds" option. If you add a build and in the process tab use a build argument like ...:/p:DeployOnBuild=True /p:DeployTarget=MsDeployPublish /p:CreatePackageOnPublish=True /p:MSDeployPublishMethod=RemoteAgent /p:MSDeployServiceUrl=http://111.111.111.111/msdeployagentservice /p:DeployIisAppPath=MySiteNameInIIS /p:UserName=myDomain\BuildUser /p:Password=BuildUserPassword In the Process tab where it says "Items to Build" you just point it to your .sln file (might work with a .cspro but then the syntax changes slightly)

We have a TFS2010 server and I deploy a few of our sites to a dev, qa, pre-production or production IIS server. I do unit testing on the dev build and if the test fail then I do not deploy.

The MSBuild command does the pre-compile, would that work for you?

若能看破又如何 2024-12-13 08:47:20

添加了预编译设置。以下工作在 Visual Studio 2015 中

  1. 打开解决方案
  2. 右键单击项目
  3. 选择“发布...”
  4. 转到设置,展开“文件
  5. 检查“发布期间预编译”

A setting for precompiling has been added. The following works in Visual Studio 2015

  1. Open a solution
  2. Right click on the project
  3. Select "Publish..."
  4. Go to settings, expand "File
  5. Check "Precompile during Publishing"
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文