博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Changing the Output Path in your Web Applications is a bad idea
阅读量:5110 次
发布时间:2019-06-13

本文共 2100 字,大约阅读时间需要 7 分钟。

Let’s assume we have a WebSite(the same issue applied to WebService btw) named WebApplication1.

Now, we want to put its(the website’s) output files into some other directory (!= “bin” directory) for development reasons (working as part of a team with some sophisticated复杂的 Source Safe).

What’s the first thing you (and me) do? we use our “rational”合理的 programmer nature and Right-Click on the project->Properties->Build Tab->and changing the Output path to whatever we need.

 

(Instead of “bin\” we can write here “..\..\infrastructure” for example)

 

We then build the all thing and surprise surprise, the new output pathcontains all the dlls as expected. Awesome! 

Satisfied with the greatness of Visual Studio .Net 2005, we now want to Publish the WebSite so we(or the QA) can play with it.

“Think as a developer, think as a developer” I say to myself and Right-Click the WebSite project->Publish… A few really easy “decisions” and ~10 seconds later, VS.NET tells(it speaks to me, I swear) me that my site was published successfully.

 

Happy as a little girl with a new puppy小狗, I enter my site: and Oops哎哟!

 

The page can’t find its “code behind”(The class that it inherits from)! What the hack is going on here!?

 

Well, it turns out that the Publish process is not as smart as you may think it should be.

Changing our Output path to another directory (!= “bin”) caused this all mess as the Publish process simply copy all the files from the bin directory into the new(Published) bin directory.

No questions asked. The Publish algorithm do not check if you actually compile your dlls into another directory via Output path and taking it into account.

 

Fortunately for us, the solution is pretty easy: define your Output path into the original location (“bin\”) and use the Build Events(post-build in this scenario) in order to copy the output files into your “infrastructure”(or whatever) directory like this:

 

(The command: xcopy /Y /S ${TargetDir}*.* ..\..\Infrastructure)

 

 

May it save you the 15 minutes it took me and my teammate Hagay to solve this one.

 

转载于:https://www.cnblogs.com/chucklu/p/5301881.html

你可能感兴趣的文章
文件流的使用以及序列化和反序列化的方法使用
查看>>
Android-多线程AsyncTask
查看>>
第一个Spring冲刺周期团队进展报告
查看>>
C++函数基础知识
查看>>
红黑树 c++ 实现
查看>>
Android 获取网络链接类型
查看>>
linux中启动与终止lnmp的脚本
查看>>
gdb中信号的处理[转]
查看>>
LeetCode【709. 转换成小写字母】
查看>>
如何在Access2007中使用日期类型查询数据
查看>>
Jzoj4757 树上摩托
查看>>
CF992E Nastya and King-Shamans(线段树二分+思维)
查看>>
oracle 几个时间函数探究
查看>>
第一个Java Web程序
查看>>
树状数组_一维
查看>>
如果没有按照正常的先装iis后装.net的顺序,可以使用此命令重新注册一下:
查看>>
linux install ftp server
查看>>
嵌入式软件设计第8次实验报告
查看>>
算法和数据结构(三)
查看>>
Ubuntu下的eclipse安装subclipse遇到没有javahl的问题...(2天解决了)
查看>>