是否可以使用ODP 11 xcopy部署而不更改PATH?

时间:2021-09-28 21:14:25

I have an application that's using Oracle.DataAccess to connect. I've already discovered that the footprint can be lessened by using ODAC 11 with xcopy deployment. That's already a big win.

我有一个使用Oracle.DataAccess连接的应用程序。我已经发现使用带有xcopy部署的ODAC 11可以减少占用空间。这已经是一个巨大的胜利。

Ideally, though, we would like to not have to alter any path variables and have all the ODAC files in a subdirectory underneath the application's folder. Is it possible to do this without changing the PATH variable? Is there some way to set a temporary PATH variable? Could we copy all of the files necessary to the application folder?

但理想情况下,我们不希望更改任何路径变量,并将所有ODAC文件放在应用程序文件夹下的子目录中。是否可以在不更改PATH变量的情况下执行此操作?有没有办法设置临时PATH变量?我们可以复制应用程序文件夹所需的所有文件吗?

The general idea is that we want to isolate our ODAC files as much as possible from other applications that might be running on the same client.

一般的想法是,我们希望尽可能地将ODAC文件与可能在同一客户端上运行的其他应用程序隔离开来。

5 个解决方案

#1


4  

System.Environment.SetEnvironmentVariable allows you to modify the process environment block. Whether that's enough for notoriously PITA Oracle is anyone's guess, though. ;)

System.Environment.SetEnvironmentVariable允许您修改进程环境块。不过,对于臭名昭着的PITA Oracle来说,这是否足以让人猜测。 ;)

#2


3  

As Mark suggested, you can always have your application change the environment variable for the current process. Note that, obviously, you'll have to do it before any ODP .NET call is made.

正如Mark建议的那样,您始终可以让应用程序更改当前进程的环境变量。请注意,显然,您必须在进行任何ODP .NET调用之前执行此操作。

Also note that if you only need pure ODP .NET features, by which I mean you specifically don't need :

另请注意,如果您只需要纯ODP .NET功能,我的意思是您特别不需要:

  • Distributed transactions (TransactionScope).
  • 分布式事务(TransactionScope)。

  • ODBC.
  • OLEDB.

If you are in this case, you can only distribute Oracle Instant Client with your application. See this question for more details.

如果您是这种情况,则只能将Oracle Instant Client与您的应用程序一起分发。有关详细信息,请参阅此问题。

#3


2  

Changing the Environment variable is a sweet hack, but just for academic completeness I think embedding assembly resolving is actually the 'proper' way to solve this problem, even if it is more code.

更改环境变量是一个甜蜜的黑客,但仅仅为了学术完整性,我认为嵌入程序集解析实际上是解决此问题的“正确”方法,即使它是更多的代码。

#4


0  

Yes you can, see http://ora-00001.blogspot.com/2010/01/odpnet-minimal-non-intrusive-install.html for details.

是的,您可以参阅http://ora-00001.blogspot.com/2010/01/odpnet-minimal-non-intrusive-install.html了解详情。

#5


0  

As was mentioned earlier, this * question talks about how one might accomplish your goal. This answer is quite good. I commented on that answer that I was able to use an Easy Connect connection string and use the same binary on my production machine and my development machine by simply copying the Instant Client Lite DLLs and Oracle.DataAccess.dll to the application folder on the production machine. On my development machine I have the full Oracle Client installed. This way there is no need to modify path statements at all.

如前所述,此*问题讨论了如何实现目标。这个答案非常好。我评论了这个答案,我能够使用Easy Connect连接字符串并在我的生产机器和我的开发机器上使用相同的二进制文件,只需将Instant Client Lite DLL和Oracle.DataAccess.dll复制到生产中的应用程序文件夹即可机。在我的开发机器上,我安装了完整的Oracle客户端。这样就根本不需要修改路径语句。

#1


4  

System.Environment.SetEnvironmentVariable allows you to modify the process environment block. Whether that's enough for notoriously PITA Oracle is anyone's guess, though. ;)

System.Environment.SetEnvironmentVariable允许您修改进程环境块。不过,对于臭名昭着的PITA Oracle来说,这是否足以让人猜测。 ;)

#2


3  

As Mark suggested, you can always have your application change the environment variable for the current process. Note that, obviously, you'll have to do it before any ODP .NET call is made.

正如Mark建议的那样,您始终可以让应用程序更改当前进程的环境变量。请注意,显然,您必须在进行任何ODP .NET调用之前执行此操作。

Also note that if you only need pure ODP .NET features, by which I mean you specifically don't need :

另请注意,如果您只需要纯ODP .NET功能,我的意思是您特别不需要:

  • Distributed transactions (TransactionScope).
  • 分布式事务(TransactionScope)。

  • ODBC.
  • OLEDB.

If you are in this case, you can only distribute Oracle Instant Client with your application. See this question for more details.

如果您是这种情况,则只能将Oracle Instant Client与您的应用程序一起分发。有关详细信息,请参阅此问题。

#3


2  

Changing the Environment variable is a sweet hack, but just for academic completeness I think embedding assembly resolving is actually the 'proper' way to solve this problem, even if it is more code.

更改环境变量是一个甜蜜的黑客,但仅仅为了学术完整性,我认为嵌入程序集解析实际上是解决此问题的“正确”方法,即使它是更多的代码。

#4


0  

Yes you can, see http://ora-00001.blogspot.com/2010/01/odpnet-minimal-non-intrusive-install.html for details.

是的,您可以参阅http://ora-00001.blogspot.com/2010/01/odpnet-minimal-non-intrusive-install.html了解详情。

#5


0  

As was mentioned earlier, this * question talks about how one might accomplish your goal. This answer is quite good. I commented on that answer that I was able to use an Easy Connect connection string and use the same binary on my production machine and my development machine by simply copying the Instant Client Lite DLLs and Oracle.DataAccess.dll to the application folder on the production machine. On my development machine I have the full Oracle Client installed. This way there is no need to modify path statements at all.

如前所述,此*问题讨论了如何实现目标。这个答案非常好。我评论了这个答案,我能够使用Easy Connect连接字符串并在我的生产机器和我的开发机器上使用相同的二进制文件,只需将Instant Client Lite DLL和Oracle.DataAccess.dll复制到生产中的应用程序文件夹即可机。在我的开发机器上,我安装了完整的Oracle客户端。这样就根本不需要修改路径语句。